home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 001 / jmodem.arc / JMODEM.LST < prev    next >
Encoding:
File List  |  1988-09-13  |  98.7 KB  |  2,064 lines

  1. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  2. JMODEM.ASM                                                  Page     1-1
  3.  
  4.  
  5.        1                PAGE    ,132 
  6.        2                TITLE JMODEM.ASM 
  7.        3                ; 
  8.        4                COMMENT * 
  9.        5                    Created    02-SEP-1988            Richard B. Johnson 
  10.        6                 
  11.        7                    Purpose: 
  12.        8                    File transfer protocol. Use with BBS systems and communications 
  13.        9                    programs that allow "external protocols". 
  14.       10                    This program will transfer a single file between the host and an 
  15.       11                    IBM compatible microcomputer. It will use data-compression when the 
  16.       12                    data can be compressed and transfers data uncompressed should comp- 
  17.       13                    ression techniques fail to reduce the block-size. 
  18.       14                 
  19.       15                    The block-size is variable, ranging from 512 bytes (plus a 6-byte 
  20.       16                    overhead) to 8192 bytes (plus a 6-byte overhead). The block-size 
  21.       17                    is increased up to the limit if there are no transmission errors. 
  22.       18                    Should errors occur, the block-size is reduced to a minimum of 512 
  23.       19                    bytes. Since the bytes transferred may be of any length, the file- 
  24.       20                    size is exactly correct after the file is received. 
  25.       21                 
  26.       22                    Data compression is used when its been found that the compression 
  27.       23                    will reduce the size of the transmitted blocks. Flow control is 
  28.       24                    also provided to interface with high-speed modems. The flow-control 
  29.       25                    techniques used are invisible to the user so no special provisions 
  30.       26                    are necessary. You don't have to add anything on the command line. 
  31.       27                 
  32.       28                    Usage: 
  33.       29                    JMODEM S1 <filename.typ>  (to send a file via COM1) 
  34.       30                    JMODEM R1 <filename.typ>  (to receive a file via COM1) 
  35.       31                    JMODEM S2 <filename.typ>  (to send a file via COM2) 
  36.       32                    JMODEM R2 <filename.typ>  (to receive a file via COM2) 
  37.       33                 
  38.       34                    Known bugs(?) 
  39.       35                    Since the DOS function 9 is used to print many strings, filenames 
  40.       36                    that contain a '$' will be incompletely displayed on the screen. 
  41.       37                    This will be fixed in the second minor revision. 
  42.       38                 
  43.       39                    Modification record:    Release 04-SEP-1988 
  44.       40                 
  45.       41                    05-SEPT-1988            Richard B. Johnson V1.01 
  46.       42                    Added interrupt on receive routines so that data could be received 
  47.       43                    while the file is being written. 
  48.       44                 
  49.       45                    07-SEPT-1988            Richard B. Johnson V1.02 
  50.       46                    Added checks for an abort in the flow-control routine. This should 
  51.       47                    prevent long time-outs if one end aborts. 
  52.       48                 
  53.       49                    07-SEPT-1988            Richard B. Johnson V1.02 
  54.       50                    Fixed bug (typo) in source code that prevented operation on COM2. 
  55.       51                    Port address 2F8H was mispelled to 02FH which prevented operation 
  56.       52                 
  57.       53                    08-SEPT-1988            Richard B. Johnson V1.03 
  58.       54                    Added a status window with direct writes to the screen to reduce 
  59. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  60. JMODEM.ASM                                                  Page     1-2
  61.  
  62.  
  63.       55                    the time necessary to show the TX/RX status 
  64.       56                 
  65.       57                    Changed the local variable [CLOCK] to a word and increased the sync 
  66.       58                    interval to allow slow users more time to get their files ready for 
  67.       59                    TX. 
  68.       60                 
  69.       61                    10-SEPT-1988            Richard B. Johnson V1.04 
  70.       62                    Fixed the print string routines so that a '$' can be displayed. 
  71.       63                    Also streamlined the FLOW control routine so a port need not be 
  72.       64                    read. Interrupts are now enabled for modem status as well as data 
  73.       65                    ready. Modem status is read and put in memory so FLOW control need 
  74.       66                    only check memory. 
  75.       67                 
  76.       68                    13-SEPT-1988            Richard B. Johnson V1.05 
  77.       69                    Added support for COM3 and COM4. Note that there are no IBM standards 
  78.       70                    denoting where the port addresses are for COM3 and COM4. They have 
  79.       71                    been put where most communications programs seem to have put them. 
  80.       72                 
  81.       73                    Note: 
  82.       74                    This must be linked as a '.COM' file. 
  83.       75                    MASM JMODEM; 
  84.       76                    LINK JMODEM; 
  85.       77                    EXE2BIN JMODEM.EXE JMODEM.COM 
  86.       78                    DEL JMODEM.EXE 
  87.       79                * 
  88.       80                ; 
  89.       81                ELSE 
  90.       82                    %OUT [PASS2] 
  91.       83                ENDIF 
  92.       84                ; 
  93.       85                VERS    STRUC 
  94.       86 0000  56 31 2E 30 35            DB    'V1.05' 
  95.       87 0005                VERS    ENDS 
  96.       88                ; 
  97.       89 = 0070                SCRATTR    EQU    01110000B        ; Screen attribute 
  98.       90 = 0012                TIMOUT    EQU    18            ; About 1 second 
  99.       91 = 000A                MAX    EQU    10            ; Max retries 
  100.       92 = 0021                MS_DOS    EQU    21H            ; MS-DOS functions 
  101.       93 = 0010                VIDEO    EQU    10H            ; Video BIOS routines 
  102.       94 = 000D                CR    EQU    0DH            ; ASCII 
  103.       95 = 000A                LF    EQU    0AH            ; ASCII 
  104.       96 = 4000                CODELOC    EQU    16384            ; Where to code/decode data 
  105.       97 = 8000                HOME    EQU    CODELOC + 16384        ; Interrupt buffer 
  106.       98 = 0021                INT_CTL    EQU    21H            ; Interrupt controller address 
  107.       99 = 000C                INT_1    EQU    0CH            ; For COM1 
  108.      100 = 000B                INT_2    EQU    0BH            ; For COM2 
  109.      101 = 00EF                IRQ4    EQU    11101111B        ; For COM1 
  110.      102 = 00F7                IRQ3    EQU    11110111B        ; For COM2 
  111.      103 = 0001                INT_RC    EQU    00000001B        ; Interrupt on received character 
  112.      104 = 0008                INT_MS    EQU    00001000B        ; Interrupt on modem status 
  113.      105 = 0004                RDAT    EQU    00000100B        ; Received data available 
  114.      106 = 0008                TRISTAT    EQU    00001000B        ; Turn on tristate buffer 
  115.      107 = 0003                RTS_DTR    EQU    00000011B        ; DTR/RTS bits 
  116.      108                ; 
  117. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  118. JMODEM.ASM                                                  Page     1-3
  119.  
  120.  
  121.      109                ;    Parameters for Various communications adapter ports. 
  122.      110                ; 
  123.      111                COM1    STRUC 
  124.      112 0000  03F8            COM1PRT    DW    03F8H            ; Base port 
  125.      113 0002  0C            COM1INT    DB    INT_1            ; IRQ4 
  126.      114 0003  EF            COM1MSK    DB    IRQ4            ; Controller mask 
  127.      115 0004                COM1    ENDS 
  128.      116                ; 
  129.      117                COM2    STRUC 
  130.      118 0000  02F8            COM2PRT    DW    02F8H            ; Base port 
  131.      119 0002  0B            COM2INT    DB    INT_2            ; IRQ3 
  132.      120 0003  F7            COM2MSK    DB    IRQ3            ; Controller mask 
  133.      121 0004                COM2    ENDS 
  134.      122                ; 
  135.      123                COM3    STRUC 
  136.      124 0000  03E8            COM3PRT    DW    03E8H            ; Base port 
  137.      125 0002  0C            COM3INT    DB    INT_1            ; IRQ4 
  138.      126 0003  EF            COM3MSK    DB    IRQ4            ; Controller mask 
  139.      127 0004                COM3    ENDS 
  140.      128                ; 
  141.      129                COM4    STRUC 
  142.      130 0000  02E8            COM4PRT    DW    02E8H            ; Base port 
  143.      131 0002  0B            COM4INT    DB    INT_2            ; IRQ3 
  144.      132 0003  F7            COM4MSK    DB    IRQ3            ; Controller mask 
  145.      133 0004                COM4    ENDS 
  146.      134                ; 
  147.      135                IBUFFER    STRUC 
  148.      136 0000  ????            LEN    DW    ?            ; String length 
  149.      137 0002  ??            CTRL    DB    ?            ; Control byte 
  150.      138 0003  ??            RECN    DB    ?            ; Record number 
  151.      139 0004  ??            IDATA    DB    ?            ; Start of data 
  152.      140 0005                IBUFFER    ENDS 
  153.      141                ; 
  154.      142                ;    Control byte context 
  155.      143                ; 
  156.      144 = 0001                NORMAL    EQU    00000001B        ; Normal data 
  157.      145 = 0002                COMP    EQU    00000010B        ; Compressed data 
  158.      146 = 0004                EOF    EQU    00000100B        ; End of file 
  159.      147 = 0008                RETRY    EQU    00001000B        ; Ask/respond with retry 
  160.      148 = 0010                TIMEOUT    EQU    00010000B        ; Informational 
  161.      149 = 0020                ABORT    EQU    00100000B        ; Kill U/D load 
  162.      150 = 0040                SYNC    EQU    01000000B        ; Hello /ack 
  163.      151 = 0080                ERROR    EQU    10000000B        ; Undefined error 
  164.      152 = FFFE                NONORM    EQU    NOT NORMAL        ; Invert 'NORMAL' bits 
  165.      153                ; 
  166.      154                ;    UART equates. 
  167.      155                ; 
  168.      156 = 0001                DR    EQU    00000001B        ; Data ready 
  169.      157 = 0010                CTS    EQU    00010000B        ; Clear to send 
  170.      158 = 0020                DSR    EQU    00100000B        ; Data set ready 
  171.      159 = 0020                THRE    EQU    00100000B        ; TX holding register empty 
  172.      160 = 0080                RLSD    EQU    10000000B        ; Rec. line signal det 
  173.      161 = 0030                CTSDSR    EQU    CTS OR DSR 
  174.      162                ; 
  175. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  176. JMODEM.ASM                                                  Page     1-4
  177.  
  178.  
  179.      163                ;    Control bytes. 
  180.      164                ; 
  181.      165 = 0006                ACK    EQU    'F' - 64 
  182.      166 = 0015                NAK    EQU    'U' - 64 
  183.      167 = 0004                EOT    EQU    'D' - 64 
  184.      168 = 0018                CAN    EQU    'X' - 64 
  185.      169 = 0016                SYN    EQU    'V' - 64 
  186.      170                ; 
  187.      171                ;    BIOS segment structure. 
  188.      172                ; 
  189.      173 0000                BSEG    SEGMENT    AT    40H 
  190.      174 0063                    ORG    63H 
  191.      175 0063  ????            ADDR_6845    DW    ?        ; Address of the video controller 
  192.      176 0065                BSEG    ENDS 
  193.      177                ; 
  194.      178 = 03F6                ORIGIN    EQU    1014            ; Where to put the status box 
  195.      179 = 0017                LINLEN    EQU    23            ; Length of a line 
  196.      180 = 054C                SCR_BLK    EQU    ORIGIN + ( (160 - (LINLEN *2) ) * 3) ; Offset to block count 
  197.      181 = 05EC                SCR_LEN    EQU    SCR_BLK + 160        ; Offset to block length 
  198.      182 = 068C                SCR_BYT    EQU    SCR_LEN + 160        ; Offset to byte count 
  199.      183 = 072C                SCR_CPS    EQU    SCR_BYT + 160        ; Offset to chars/sec 
  200.      184 = 055E                SCR_ACK    EQU    SCR_BLK + 18        ; Where to put ACK/NAK 
  201.      185                ; 
  202.      186 0000                PSEG    SEGMENT    PARA PUBLIC 'CODE' 
  203.      187 = 0000                START    EQU    $ 
  204.      188                    ASSUME    CS:PSEG, DS:PSEG, ES:PSEG, SS:NOTHING 
  205.      189 0100                    ORG    100H 
  206.      190 0100                MAIN    PROC    NEAR 
  207.      191 0100  BC 0E80 R            MOV    SP,OFFSET STACKP    ; Keep stack pointer safe 
  208.      192                ; 
  209.      193 0103  BF 09DD R            MOV    DI,OFFSET KILL        ; First variable to zero out 
  210.      194 0106  B9 000E 90            MOV    CX,KLEN            ; Length of the variable list 
  211.      195 010A  32 C0                XOR    AL,AL            ; Get a zero 
  212.      196 010C  F3/ AA                REP    STOSB            ; Set all to zero 
  213.      197                ; 
  214.      198 010E  E8 0990 R            CALL    FIND_VIDEO        ; Find the video segment 
  215.      199 0111  E8 0477 R            CALL    SET_SEG            ; Set up data segment 
  216.      200 0114  E8 0764 R            CALL    PARSE            ; Parse the command line 
  217.      201 0117  73 0E                JNC    WASOK            ; Commands okay 
  218.      202 0119  E8 08F3 R            CALL    SENDX            ; Tell other end to quit 
  219.      203 011C  BE 0AB5 R            MOV    SI,OFFSET PRP3        ; Point to 'usage' prompt 
  220.      204 011F  E8 03D9 R            CALL    PROMPT            ; Print to screen 
  221.      205 0122  B8 4C01                MOV    AX,4C01H        ; Terminate with error 
  222.      206 0125  CD 21                INT    MS_DOS 
  223.      207                ; 
  224.      208 0127  33 C0            WASOK:    XOR    AX,AX            ; Get current time 
  225.      209 0129  CD 1A                INT    1AH            ; Get the time 
  226.      210 012B  89 16 09DB R            MOV    WORD PTR [TIM_L],DX    ; Save new LOW count 
  227.      211 012F  80 3E 09EE R 53            CMP    BYTE PTR [RXTX],'S'    ; Do we want to send? 
  228.      212 0134  74 03                JZ    SEND            ; Yes 
  229.      213 0136  E9 01CA R            JMP    RECV            ; Else receive 
  230.      214 0139                MAIN    ENDP 
  231.      215                ; 
  232.      216                ;    Send file contents to remote. 
  233. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  234. JMODEM.ASM                                                  Page     1-5
  235.  
  236.  
  237.      217                ; 
  238.      218 0139                SEND    PROC    NEAR 
  239.      219 0139  C6 06 09ED R 00            MOV    BYTE PTR [TRIES],0    ; Conditional for Read 
  240.      220 013E  E8 04A9 R            CALL    SET_INT            ; Set up interrupts 
  241.      221 0141  BE 0C5C R            MOV    SI,OFFSET PRP7        ; Point to 'Sending' 
  242.      222 0144  E8 03D9 R            CALL    PROMPT            ; Print to screen 
  243.      223 0147  E8 059E R            CALL    OPEN_R            ; Open for read 
  244.      224 014A  72 64                JC    EXITF            ; Can't open the file 
  245.      225 014C  BE 0CFA R            MOV    SI,OFFSET FNAME        ; Point to filename 
  246.      226 014F  E8 03D9 R            CALL    PROMPT            ; Print to screen 
  247.      227 0152  BE 0C28 R            MOV    SI,OFFSET CRLF        ; End of the line 
  248.      228 0155  E8 03D9 R            CALL    PROMPT            ; Print to screen 
  249.      229 0158  E8 062E R            CALL    READ            ; Read the file first 
  250.      230 015B  E8 0397 R            CALL    TXSYNCH            ; Synchronize 
  251.      231 015E  72 50                JC    EXITF            ; Abort 
  252.      232 0160  E8 08FE R            CALL    SAV_SCR 
  253.      233 0163  E8 0970 R            CALL    WRT_SCR 
  254.      234 0166  EB 06                JMP    SHORT BYPASS        ; Bypass first read (already done) 
  255.      235 0168  E8 07FC R        SEND0:    CALL    SHOW            ; Show what we are doing 
  256.      236 016B  E8 062E R            CALL    READ            ; Read the file 
  257.      237 016E  C6 06 09ED R 0A        BYPASS:    MOV    BYTE PTR [TRIES],MAX    ; Max attempts to send blocks 
  258.      238 0173  E8 0277 R        SEND1:    CALL    SDATA            ; Send the data 
  259.      239                ; 
  260.      240 0176  E8 031C R        SEND2:    CALL    GET_ACK            ; Get host ackknowlege 
  261.      241 0179  72 35                JC    EXITF            ; Fatal exit 
  262.      242 017B  75 20                JNZ    CHKRES            ; Was not good 
  263.      243 017D  B0 20                MOV    AL,' '            ; Clear any error mes 
  264.      244 017F  E8 03CD R            CALL    SHO_RES            ;   on the screen 
  265.      245 0182  80 3E 09E7 R 00            CMP    BYTE PTR [FEND],0    ; Check for file end 
  266.      246 0187  74 DF                JZ    SEND0            ; Not end of the file yet 
  267.      247 0189  E8 093B R            CALL    RES_SCR            ; Restore the screen. 
  268.      248                ; 
  269.      249 018C  BE 0C97 R            MOV    SI,OFFSET PRP10        ; Point to the prompt 
  270.      250 018F  E8 03D9 R            CALL    PROMPT 
  271.      251 0192  E8 0624 R            CALL    CLOSE            ; Close the file 
  272.      252 0195  E8 054A R            CALL    RES_INT            ; Restore vectors 
  273.      253 0198  B8 4C00                MOV    AX,4C00H        ; Exit with NO errors 
  274.      254 019B  CD 21                INT    MS_DOS            ; Do it now 
  275.      255                ; 
  276.      256 019D  3C 18            CHKRES:    CMP    AL,CAN            ; Wanted to cancel? 
  277.      257 019F  74 0F                JZ    EXITF            ; Yes 
  278.      258 01A1  3C 15                CMP    AL,NAK            ; Is it a NAK? 
  279.      259 01A3  75 D1                JNZ    SEND2            ; No, must be garbage, try again. 
  280.      260 01A5  B0 2A                MOV    AL,'*'            ; Was a NAK. 
  281.      261 01A7  E8 03CD R            CALL    SHO_RES            ; Show error response 
  282.      262 01AA  FE 0E 09ED R            DEC    BYTE PTR [TRIES]    ; Bump retries 
  283.      263 01AE  75 C3                JNZ    SEND1            ; Continue 
  284.      264                ; 
  285.      265 01B0  BC 0E80 R        EXITF:    MOV    SP,OFFSET STACKP    ; Level stack 
  286.      266 01B3  E8 08F3 R            CALL    SENDX            ; Tell other end to quit 
  287.      267 01B6  E8 093B R            CALL    RES_SCR            ; Restore screen state 
  288.      268 01B9  BE 0C7E R            MOV    SI,OFFSET PRP9        ; Point to 'aborted' 
  289.      269 01BC  E8 03D9 R            CALL    PROMPT            ; Print to screen 
  290.      270 01BF  E8 0624 R            CALL    CLOSE            ; Close the file 
  291. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  292. JMODEM.ASM                                                  Page     1-6
  293.  
  294.  
  295.      271 01C2  E8 054A R            CALL    RES_INT            ; Restore interrupts 
  296.      272 01C5  B8 4C01                MOV    AX,4C01H        ; Exit with error 
  297.      273 01C8  CD 21                INT    MS_DOS            ; Do it now 
  298.      274 01CA                SEND    ENDP 
  299.      275                ; 
  300.      276                ;    Receive a file from remote 
  301.      277                ; 
  302.      278 01CA                RECV    PROC    NEAR 
  303.      279 01CA  E8 04A9 R            CALL    SET_INT            ; Set up interrupts 
  304.      280 01CD  BE 0C6C R            MOV    SI,OFFSET PRP8        ; Point to 'receiving' 
  305.      281 01D0  E8 03D9 R            CALL    PROMPT            ; Print to screen 
  306.      282 01D3  E8 05C1 R            CALL    OPEN_W            ; Open for write 
  307.      283 01D6  72 33                JC    CANCEL            ; Bad open 
  308.      284 01D8  BE 0CFA R            MOV    SI,OFFSET FNAME        ; Point to filename 
  309.      285 01DB  E8 03D9 R            CALL    PROMPT            ; Print to screen 
  310.      286 01DE  BE 0C28 R            MOV    SI,OFFSET CRLF 
  311.      287 01E1  E8 03D9 R            CALL    PROMPT 
  312.      288 01E4  E8 0397 R            CALL    RXSYNCH            ; Establish communications 
  313.      289 01E7  72 22                JC    CANCEL            ; No good, quit. 
  314.      290 01E9  E8 08FE R            CALL    SAV_SCR            ; Save screen context 
  315.      291 01EC  E8 0970 R            CALL    WRT_SCR            ; Write box on screen 
  316.      292 01EF  C6 06 09ED R 0A            MOV    BYTE PTR [TRIES],MAX    ; Max re-tries 
  317.      293 01F4  EB 0A                JMP    SHORT NONAK        ; Bypass the initial NAK 
  318.      294 01F6  B0 2A            RECV0:    MOV    AL,'*' 
  319.      295 01F8  E8 03CD R            CALL    SHO_RES            ; Show response 
  320.      296 01FB  B0 15                MOV    AL,NAK            ; Get a NAK 
  321.      297 01FD  E8 02A3 R        RECV1:    CALL    RESP            ; Send to remote 
  322.      298 0200  E8 0350 R        NONAK:    CALL    RDATA            ; Receive data 
  323.      299 0203  73 20                JNC    RECV3            ; Good block 
  324.      300 0205  FE 0E 09ED R        RECV2:    DEC    BYTE PTR [TRIES]    ; Bump retries 
  325.      301 0209  75 EB                JNZ    RECV0            ; Send a NAK and try again 
  326.      302                ; 
  327.      303 020B  BC 0E80 R        CANCEL:    MOV    SP,OFFSET STACKP    ; Level stack 
  328.      304 020E  E8 08F3 R            CALL    SENDX            ; Tell remote to quit 
  329.      305 0211  E8 093B R            CALL    RES_SCR            ; Restore screen context 
  330.      306 0214  BE 0C7E R            MOV    SI,OFFSET PRP9        ; Point to 'aborted' 
  331.      307 0217  E8 03D9 R            CALL    PROMPT            ; Print to screen 
  332.      308 021A  E8 0624 R            CALL    CLOSE            ; Close the file 
  333.      309 021D  E8 054A R            CALL    RES_INT            ; Restore interrupts 
  334.      310 0220  B8 4C01                MOV    AX,4C01H        ; Exit with error 
  335.      311 0223  CD 21                INT    MS_DOS            ; Exit now 
  336.      312                ; 
  337.      313 0225  E8 044E R        RECV3:    CALL    CRC            ; Check the CRC 
  338.      314 0228  75 DB                JNZ    RECV2            ; Bad CRC 
  339.      315 022A  B0 06                MOV    AL,ACK            ; Get an ACK 
  340.      316 022C  E8 02A3 R            CALL    RESP            ; Send to remote 
  341.      317 022F  B0 20                MOV    AL,' ' 
  342.      318 0231  E8 03CD R            CALL    SHO_RES            ; Show good response 
  343.      319 0234  E8 06C4 R            CALL    WRITE            ; Write the file 
  344.      320 0237  72 D2                JC    CANCEL            ; Write past end of disk! 
  345.      321 0239  1E                PUSH    DS            ; Save segment 
  346.      322 023A  8E 1E 09F3 R            MOV    DS,WORD PTR [BUF_SEG]    ; Get buffer segment 
  347.      323 023E  A0 0002                MOV    AL,BYTE PTR DS:[CTRL]    ; Get control byte 
  348.      324 0241  1F                POP    DS            ; Restore segment 
  349. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  350. JMODEM.ASM                                                  Page     1-7
  351.  
  352.  
  353.      325 0242  A8 04                TEST    AL,EOF            ; Check for end-of-file 
  354.      326 0244  75 0B                JNZ    END_F            ; Is end of file 
  355.      327 0246  A8 20                TEST    AL,ABORT        ; Check for abort 
  356.      328 0248  75 C1                JNZ    CANCEL            ; It was an abort 
  357.      329 024A  C6 06 09ED R 0A            MOV    BYTE PTR [TRIES],MAX    ; Reset the retry count 
  358.      330 024F  EB AF                JMP    SHORT NONAK        ; Get more 
  359.      331                ; 
  360.      332 0251  BC 0E80 R        END_F:    MOV    SP,OFFSET STACKP    ; Level stack 
  361.      333 0254  B0 20                MOV    AL,' ' 
  362.      334 0256  E8 03CD R            CALL    SHO_RES            ; Show response 
  363.      335 0259  B9 0005                MOV    CX,5            ; Number of ACKs 
  364.      336 025C  B0 06            ENDACK:    MOV    AL,ACK            ; Get an ack 
  365.      337 025E  E8 02A3 R            CALL    RESP            ; Send to remote 
  366.      338 0261  E2 F9                LOOP    ENDACK            ; Send a few. 
  367.      339 0263  E8 093B R            CALL    RES_SCR            ; Restore screen context 
  368.      340 0266  BE 0C97 R            MOV    SI,OFFSET PRP10        ; Point to 'good' 
  369.      341 0269  E8 03D9 R            CALL    PROMPT            ; Print to screen 
  370.      342 026C  E8 0624 R            CALL    CLOSE            ; Close the file 
  371.      343 026F  E8 054A R            CALL    RES_INT            ; Restore vectors 
  372.      344 0272  B8 4C00                MOV    AX,4C00H        ; Exit with NO errors 
  373.      345 0275  CD 21                INT    MS_DOS 
  374.      346 0277                RECV    ENDP 
  375.      347                ; 
  376.      348                ;    Send data. Data is in the BUFFER.IDATA 
  377.      349                ; 
  378.      350 0277                SDATA    PROC    NEAR 
  379.      351 0277  8B 16 0A10 R            MOV    DX,WORD PTR [PORT]    ; Get port address 
  380.      352 027B  A0 09E9 R            MOV    AL,BYTE PTR [REC_NOL]    ; Get low byte of rec to xmit. 
  381.      353 027E  1E                PUSH    DS            ; Save segment 
  382.      354 027F  8E 1E 09F3 R            MOV    DS,WORD PTR [BUF_SEG]    ; Pick up data buffer 
  383.      355 0283  8B 0E 0000            MOV    CX,WORD PTR DS:[LEN]    ; Get the string length 
  384.      356 0287  A2 0003                MOV    BYTE PTR DS:[RECN],AL    ; Record number 
  385.      357 028A  E8 044E R            CALL    CRC            ; Calculate the CRC 
  386.      358 028D  33 F6                XOR    SI,SI            ; Offset Zero 
  387.      359 028F  83 C2 05            SDATA1:    ADD    DX,5            ; Offset to status 
  388.      360 0292  EC            SDATA2:    IN    AL,DX            ; Get UART status 
  389.      361 0293  A8 20                TEST    AL,THRE            ; Test holding register ready 
  390.      362 0295  74 FB                JZ    SDATA2            ; Wait 
  391.      363 0297  E8 03E8 R            CALL    FLOW            ; Flow control 
  392.      364 029A  83 EA 05                SUB    DX,5            ; To base port 
  393.      365 029D  AC                LODSB                ; Get memory byte 
  394.      366 029E  EE                OUT    DX,AL            ; Output to UART 
  395.      367 029F  E2 EE                LOOP    SDATA1            ; Continue for all bytes 
  396.      368 02A1  1F                POP    DS            ; Restore data segment 
  397.      369 02A2  C3                RET                ; Exit 
  398.      370 02A3                SDATA    ENDP 
  399.      371                ; 
  400.      372                ;    Send a single byte in AL to the modem port. 
  401.      373                ; 
  402.      374 02A3                RESP    PROC    NEAR 
  403.      375 02A3  E8 03E8 R            CALL    FLOW            ; Flow control 
  404.      376 02A6                FORCE    PROC    NEAR            ; Force output, no flow control 
  405.      377 02A6  52                PUSH    DX            ; Save 
  406.      378 02A7  50                PUSH    AX            ; Save byte 
  407. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  408. JMODEM.ASM                                                  Page     1-8
  409.  
  410.  
  411.      379 02A8  2E: 8B 16 0A10 R            MOV    DX,WORD PTR CS:[PORT]    ; Get modem port 
  412.      380 02AD  83 C2 05                ADD    DX,5            ; Offset to status 
  413.      381 02B0  EC            RESP0:    IN    AL,DX            ; Get the status 
  414.      382 02B1  24 20                AND    AL,THRE            ; Test holding register ready 
  415.      383 02B3  74 FB                JZ    RESP0            ; Wait 
  416.      384 02B5  83 EA 05                SUB    DX,5            ; To base port 
  417.      385 02B8  58                POP    AX            ; Restore byte to send 
  418.      386 02B9  EE                OUT    DX,AL            ; Output to UART 
  419.      387 02BA  5A                POP    DX            ; Restore 
  420.      388 02BB  C3                RET 
  421.      389 02BC                FORCE    ENDP 
  422.      390 02BC                RESP    ENDP 
  423.      391                ; 
  424.      392                ;    Easy interrupt happens each time a byte is assembled in the UART. 
  425.      393                ;    The byte is stacked in the interrupt buffer and the time-out clock 
  426.      394                ;    is reset. An appropriate reset is also sent to the interrupt 
  427.      395                ;    controller. 
  428.      396                ; 
  429.      397 02BC                EASY_INT    PROC    FAR 
  430.      398 02BC  50                PUSH    AX            ; Save registers used. 
  431.      399 02BD  53                PUSH    BX 
  432.      400 02BE  52                PUSH    DX 
  433.      401 02BF  1E                PUSH    DS 
  434.      402                ; 
  435.      403 02C0  0E                PUSH    CS 
  436.      404 02C1  1F                POP    DS            ; DS=CS 
  437.      405                ; 
  438.      406 02C2  8B 16 0A10 R            MOV    DX,WORD PTR [PORT]    ; Get port address 
  439.      407 02C6  83 C2 02                ADD    DX,2            ; Offset to interrupt ident regis. 
  440.      408 02C9  EC                IN    AL,DX            ; Get mask 
  441.      409 02CA  24 07                AND    AL,00000111B        ; Mask all but lower 3 bits 
  442.      410 02CC  A8 01                TEST    AL,00000001B        ; Check for interrupt pending 
  443.      411 02CE  75 29                JNZ    INT_EX            ; No interupts pending 
  444.      412 02D0  A8 04                TEST    AL,RDAT            ; See if data pending 
  445.      413 02D2  75 09                JNZ    INT_DAT            ; Yes, get it 
  446.      414 02D4  83 C2 04                ADD    DX,4            ; Offset to modem status 
  447.      415 02D7  EC                IN    AL,DX            ; Get modem status 
  448.      416 02D8  A2 09E8 R            MOV    BYTE PTR [MOD_STA],AL    ; Save in CS 
  449.      417 02DB  EB 1C                JMP    SHORT INT_EX        ; Leave 
  450.      418 02DD                INT_DAT: 
  451.      419 02DD  83 EA 02                SUB    DX,2            ; Back to base port 
  452.      420 02E0  EC                IN    AL,DX            ; Get the byte 
  453.      421 02E1  8B 1E 0A0A R            MOV    BX,WORD PTR [WPOINT]    ; Pick up write pointer 
  454.      422 02E5  FF 06 0A0A R            INC    WORD PTR [WPOINT]    ; Ready next 
  455.      423 02E9  FF 06 0A08 R            INC    WORD PTR [BYTE_CNT]    ; Count of bytes in the buffer 
  456.      424 02ED  C7 06 09EF R 0012        MOV    WORD PTR [CLOCK],TIMOUT    ; Set timeout to max again 
  457.      425 02F3  8E 1E 09F3 R            MOV    DS,WORD PTR [BUF_SEG]    ; Pick up buffer segment 
  458.      426 02F7  88 07                MOV    BYTE PTR [BX],AL    ; Put byte in the buffer 
  459.      427 02F9  B0 20            INT_EX:    MOV    AL,20H            ; Non-specific end-of-interrupt 
  460.      428 02FB  E6 20                OUT    20H,AL            ; Reset the controller 
  461.      429                ; 
  462.      430 02FD  1F                POP    DS            ; Restore registers used 
  463.      431 02FE  5A                POP    DX 
  464.      432 02FF  5B                POP    BX 
  465. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  466. JMODEM.ASM                                                  Page     1-9
  467.  
  468.  
  469.      433 0300  58                POP    AX 
  470.      434 0301  CF                IRET 
  471.      435 0302                EASY_INT    ENDP 
  472.      436                ; 
  473.      437                ;    Return byte count in interrupt buffer in CX. 
  474.      438                ; 
  475.      439 0302                CHK_STA    PROC    NEAR 
  476.      440 0302  FA                CLI                ; No interrupts 
  477.      441 0303  2E: 8B 0E 0A08 R            MOV   CX,WORD PTR CS:[BYTE_CNT]    ; Get byte count 
  478.      442 0308  0B C9                OR    CX,CX            ; Test for zero 
  479.      443 030A  75 0E                JNZ    CHK_EX            ; Got some bytes 
  480.      444 030C                CLR_BUF    PROC    NEAR 
  481.      445 030C  2E: C7 06 0A0A R 8000        MOV   WORD PTR CS:[WPOINT],HOME    ; Set pointer to top of buffer 
  482.      446 0313  2E: C7 06 0A08 R 0000        MOV   WORD PTR CS:[BYTE_CNT],0    ; Zero the byte-count 
  483.      447 031A  FB            CHK_EX:    STI                ; Allow interrupts 
  484.      448 031B  C3                RET 
  485.      449 031C                CLR_BUF    ENDP 
  486.      450 031C                CHK_STA    ENDP 
  487.      451                ; 
  488.      452                ;    Get a single byte from the remote. Check to see if its an ACK. 
  489.      453                ; 
  490.      454 031C                GET_ACK    PROC    NEAR 
  491.      455 031C  C7 06 09EF R 00FF        MOV    WORD PTR [CLOCK],255    ; Max time to wait 
  492.      456 0322                GET_INP    PROC    NEAR 
  493.      457 0322  51                PUSH    CX            ; Save count 
  494.      458 0323  83 3E 09EF R 00        GET0:    CMP    WORD PTR [CLOCK],0    ; Check for timeout 
  495.      459 0328  74 17                JZ    GET1 
  496.      460 032A  E8 0302 R            CALL    CHK_STA            ; Check status 
  497.      461 032D  74 F4                JZ    GET0            ; No bytes available 
  498.      462                ; 
  499.      463 032F  FA                CLI                ; CLR_BUF enables 
  500.      464 0330  E8 030C R            CALL    CLR_BUF            ; Clear any garbage. 
  501.      465 0333  1E                PUSH    DS 
  502.      466 0334  8E 1E 09F3 R            MOV    DS,WORD PTR [BUF_SEG]    ; Pick up buffer segment 
  503.      467 0338  A0 8000                MOV    AL,BYTE PTR DS:[HOME]    ; Pick up byte at bottom 
  504.      468 033B  1F                POP    DS 
  505.      469 033C  3C 06                CMP    AL,ACK            ; Check for an ACK 
  506.      470 033E  F8                CLC                ; Clear carry 
  507.      471 033F  EB 01                JMP    SHORT GET2        ; Exit 
  508.      472                ; 
  509.      473 0341  F9            GET1:    STC                ; Set carry for error 
  510.      474 0342  59            GET2:    POP    CX            ; Restore count 
  511.      475 0343  C3                RET 
  512.      476 0344                GET_INP    ENDP 
  513.      477 0344                GET_ACK    ENDP 
  514.      478                ; 
  515.      479                ;    Eat any incoming bytes. 
  516.      480                ; 
  517.      481 0344                EAT    PROC    NEAR 
  518.      482 0344  C7 06 09EF R 0012        MOV    WORD PTR [CLOCK],TIMOUT    ; Maximum time to wait 
  519.      483 034A  E8 0322 R        EAT0:    CALL    GET_INP            ; Get any trash 
  520.      484 034D  73 FB                JNC    EAT0            ; Continue until nothing available 
  521.      485 034F  C3                RET 
  522.      486 0350                EAT    ENDP 
  523. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  524. JMODEM.ASM                                                  Page     1-10
  525.  
  526.  
  527.      487                ; 
  528.      488                ;    Receive data string from remote. First word is the string length. 
  529.      489                ; 
  530.      490 0350                RDATA    PROC    NEAR 
  531.      491 0350  C7 06 09EF R 00FF        MOV    WORD PTR [CLOCK],255    ; Max time to wait 
  532.      492                ; 
  533.      493                ;    Wait for the first two bytes so we know how many bytes are supposed 
  534.      494                ;    to be received. 
  535.      495                ; 
  536.      496 0356  83 3E 09EF R 00        RDATA0:    CMP    WORD PTR [CLOCK],0    ; Check for timeout 
  537.      497 035B  74 38                JZ    RDATA2            ; Timed out 
  538.      498 035D  E8 0302 R            CALL    CHK_STA            ; Check status 
  539.      499 0360  83 F9 02                CMP    CX,2            ; Check for two bytes received 
  540.      500 0363  72 F1                JC    RDATA0            ; Not here yet 
  541.      501 0365  1E                PUSH    DS 
  542.      502 0366  8E 1E 09F3 R            MOV    DS,WORD PTR [BUF_SEG]    ; Pick up buffer segment 
  543.      503 036A  A1 8000                MOV    AX,WORD PTR DS:[HOME]    ; Pick up word at bottom 
  544.      504 036D  1F                POP    DS 
  545.      505                ; 
  546.      506                ;    AX now contains the string length. Wait until the entire string is 
  547.      507                ;    received by checking the status. 
  548.      508                ; 
  549.      509 036E  83 3E 09EF R 00        RDATA1:    CMP    WORD PTR [CLOCK],0    ; Check for timeout 
  550.      510 0373  74 20                JZ    RDATA2            ; Timed out 
  551.      511 0375  E8 0302 R            CALL    CHK_STA            ; Check status 
  552.      512 0378  3B C8                CMP    CX,AX            ; Check byte count 
  553.      513 037A  72 F2                JC    RDATA1            ; Not here yet 
  554.      514                ; 
  555.      515                ;    Got all the bytes we need, now transfer them. 
  556.      516                ; 
  557.      517 037C  1E                PUSH    DS 
  558.      518 037D  06                PUSH    ES 
  559.      519 037E  A1 09F3 R            MOV    AX,WORD PTR [BUF_SEG]    ; Pick up segment 
  560.      520 0381  8E C0                MOV    ES,AX 
  561.      521 0383  8E D8                MOV    DS,AX            ; Fix up segments 
  562.      522 0385  BE 8000                MOV    SI,HOME            ; Where data is 
  563.      523 0388  BF 0000                MOV    DI,LEN            ; Where to put it 
  564.      524 038B  F3/ A4                REP    MOVSB            ; transfer it 
  565.      525 038D  07                POP    ES            ; Restore registers 
  566.      526 038E  1F                POP    DS 
  567.      527 038F  FA                CLI                ; CLR_BUF enables 
  568.      528 0390  E8 030C R            CALL    CLR_BUF            ; Clear the buffer 
  569.      529 0393  F8                CLC                ; Show no errors 
  570.      530 0394  C3                RET 
  571.      531                ; 
  572.      532                ;    Timeout error return 
  573.      533                ; 
  574.      534 0395  F9            RDATA2:    STC 
  575.      535 0396  C3                RET 
  576.      536 0397                RDATA    ENDP 
  577.      537                ; 
  578.      538                ;    Attempt to synchronize TX/RX 
  579.      539                ; 
  580.      540 0397                TXSYNCH    PROC    NEAR            ;  
  581. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  582. JMODEM.ASM                                                  Page     1-11
  583.  
  584.  
  585.      541 0397                RXSYNCH    PROC    NEAR 
  586.      542 0397  BE 0CDF R            MOV    SI,OFFSET PRP13        ; Pick up prompt 
  587.      543 039A  E8 03D9 R            CALL    PROMPT            ; Print to console 
  588.      544 039D  FA                CLI                ; CLR_BUF enables 
  589.      545 039E  E8 030C R            CALL    CLR_BUF            ; Clear any garbage 
  590.      546 03A1  C7 06 09EF R 0200        MOV    WORD PTR [CLOCK],512    ; Max time to wait 
  591.      547 03A7  B9 0040                MOV    CX,64            ; Bytes to TX/RX 
  592.      548                                    ; Bytes to get 
  593.      549 03AA  B0 16            RXSYN0:    MOV    AL,SYN            ; Send a SYN byte 
  594.      550 03AC  E8 02A3 R            CALL    RESP            ; Send to remote 
  595.      551 03AF  E8 0322 R            CALL    GET_INP            ; Get a byte 
  596.      552 03B2  72 17                JC    RXSYN2            ; Exit fatal 
  597.      553 03B4  3C 18                CMP    AL,CAN            ; Was it a ^X? 
  598.      554 03B6  74 13                JZ    RXSYN2            ; Yes, Exit fatal 
  599.      555 03B8  3C 16                CMP    AL,SYN            ; Get SYNC character? 
  600.      556 03BA  75 EE                JNZ    RXSYN0            ; No, wait some more 
  601.      557 03BC  E2 EC                LOOP    RXSYN0            ; Continue for all bytes 
  602.      558 03BE  BE 0CC9 R            MOV    SI,OFFSET PRP12        ; Pick up prompt 
  603.      559 03C1  E8 03D9 R            CALL    PROMPT            ; Print to console 
  604.      560 03C4  B0 16                MOV    AL,SYN            ; Send a SYN byte 
  605.      561 03C6  E8 02A3 R            CALL    RESP            ; Send to remote 
  606.      562 03C9  F8                CLC 
  607.      563 03CA  C3                RET 
  608.      564 03CB  F9            RXSYN2:    STC                ; Abort 
  609.      565 03CC  C3                RET 
  610.      566 03CD                RXSYNCH    ENDP 
  611.      567 03CD                TXSYNCH    ENDP 
  612.      568                ; 
  613.      569                ;    Show ACK/NAK with a '*' after the block 
  614.      570                ; 
  615.      571 03CD                SHO_RES    PROC    NEAR 
  616.      572 03CD  1E                PUSH    DS            ; Save screen segment 
  617.      573 03CE  8E 1E 0A0E R            MOV    DS,WORD PTR [SCR_SEG]    ; Pick up screen segment 
  618.      574 03D2  B4 70                MOV    AH,SCRATTR        ; Normal attribute 
  619.      575 03D4  A3 055E                MOV    WORD PTR DS:[SCR_ACK],AX    ; Put on the screen 
  620.      576 03D7  1F                POP    DS 
  621.      577 03D8  C3                RET 
  622.      578 03D9                SHO_RES    ENDP 
  623.      579                ; 
  624.      580                ;    Print string to console until a NULL. String location in SI 
  625.      581                ; 
  626.      582 03D9                PROMPT    PROC    NEAR 
  627.      583 03D9  AC                LODSB                ; Get byte 
  628.      584 03DA  0A C0                OR    AL,AL            ; Check for a null 
  629.      585 03DC  74 09                JZ    PREXT            ; End of the string 
  630.      586 03DE  B4 0E                MOV    AH,14            ; 'Dumb' terminal mode 
  631.      587 03E0  BB 0007                MOV    BX,0007H        ; Normal attribute 
  632.      588 03E3  CD 10                INT    VIDEO            ; Print character 
  633.      589 03E5  EB F2                JMP    SHORT PROMPT        ; Continue 
  634.      590 03E7  C3            PREXT:    RET 
  635.      591 03E8                PROMPT    ENDP 
  636.      592                ; 
  637.      593                ;    Flow control and carrier detect. 
  638.      594                ; 
  639. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  640. JMODEM.ASM                                                  Page     1-12
  641.  
  642.  
  643.      595 03E8                FLOW    PROC    NEAR 
  644.      596 03E8  50                PUSH    AX            ; Save byte 
  645.      597 03E9  51                PUSH    CX            ; Save any count 
  646.      598 03EA  1E                PUSH    DS            ; Save data segment 
  647.      599 03EB  0E                PUSH    CS 
  648.      600 03EC  1F                POP    DS            ; DS=CS 
  649.      601 03ED  80 3E 09E4 R 00            CMP    BYTE PTR [ENABLE],0    ; Original mask 
  650.      602 03F2  74 56                JZ    CONT1            ; Ignore flow control 
  651.      603 03F4  80 3E 09DD R 00        FLOW0:    CMP    BYTE PTR [KILL],0    ; Check for an abort 
  652.      604 03F9  75 14                JNZ    BYEBYE            ; Wanted to abort 
  653.      605 03FB  A0 09E8 R            MOV    AL,BYTE PTR [MOD_STA]    ; Get modem status 
  654.      606 03FE  A8 80                TEST    AL,RLSD            ; Check for carrier 
  655.      607 0400  75 27                JNZ    CAROK            ; Carrier is still okay 
  656.      608 0402  80 3E 09E5 R 00            CMP    BYTE PTR [WASC],0    ; See if a carrier when we started 
  657.      609 0407  74 20                JZ    CAROK            ; No, ignore status 
  658.      610 0409  BE 0CB1 R            MOV    SI,OFFSET PRP11        ; Point to carrier failed 
  659.      611 040C  E8 03D9 R            CALL    PROMPT 
  660.      612 040F  BC 0E80 R        BYEBYE:    MOV    SP,OFFSET STACKP    ; Level stack 
  661.      613 0412  E8 0624 R            CALL    CLOSE            ; Close the file 
  662.      614 0415  E8 08F3 R            CALL    SENDX            ; Tell other end to quit. 
  663.      615 0418  E8 093B R            CALL    RES_SCR            ; Restore screen 
  664.      616 041B  BE 0C7E R            MOV    SI,OFFSET PRP9        ; Point to aborted 
  665.      617 041E  E8 03D9 R            CALL    PROMPT            ; Print to screen 
  666.      618 0421  E8 054A R            CALL    RES_INT            ; Restore interrupts 
  667.      619 0424  B8 4C01                MOV    AX,4C01H        ; Error exit 
  668.      620 0427  CD 21                INT    MS_DOS            ; Exit 
  669.      621                ; 
  670.      622 0429  24 30            CAROK:    AND    AL,CTSDSR        ; Mask all but DSR/CTS 
  671.      623 042B  3A 06 09E4 R            CMP    AL,BYTE PTR [ENABLE]    ; Original mask 
  672.      624 042F  74 02                JZ    CONT0            ; Okay to continue 
  673.      625 0431  EB C1                JMP    SHORT FLOW0        ; Wait until Okay 
  674.      626                ; 
  675.      627 0433  E8 0302 R        CONT0:    CALL    CHK_STA            ; Check for any incomming bytes 
  676.      628 0436  74 12                JZ    CONT1            ; Buffer's clear 
  677.      629 0438  1E                PUSH    DS            ; Save segment 
  678.      630 0439  2E: 8E 1E 09F3 R            MOV   DS,WORD PTR CS:[BUF_SEG]    ; Pick up segment 
  679.      631 043E  A0 8000                MOV    AL,BYTE PTR DS:[HOME]    ; Get byte in the buffer 
  680.      632 0441  1F                POP    DS            ; Restore segment 
  681.      633 0442  3C 18                CMP    AL,CAN            ; Want to cancel? 
  682.      634 0444  74 C9                JZ    BYEBYE            ; Yes 
  683.      635 0446  FA                CLI                ; CLR_BUF Restores 
  684.      636 0447  E8 030C R            CALL    CLR_BUF            ; Clear the buffer 
  685.      637                ; 
  686.      638 044A  1F            CONT1:    POP    DS            ; Restore segment 
  687.      639 044B  59                POP    CX            ; Restore any count 
  688.      640 044C  58                POP    AX            ; Restore byte 
  689.      641 044D  C3                RET 
  690.      642 044E                FLOW    ENDP 
  691.      643                ; 
  692.      644                ;    Make/check CRC word. String is in BUFFER 
  693.      645                ; 
  694.      646 044E                CRC    PROC    NEAR 
  695.      647 044E  51                PUSH    CX 
  696.      648 044F  56                PUSH    SI 
  697. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  698. JMODEM.ASM                                                  Page     1-13
  699.  
  700.  
  701.      649 0450  1E                PUSH    DS 
  702.      650 0451  2E: 8E 1E 09F3 R            MOV    DS,WORD PTR CS:[BUF_SEG]    ; Pick up buffer segment 
  703.      651 0456  8B 0E 0000            MOV    CX,WORD PTR DS:[LEN]    ; Get string length 
  704.      652 045A  83 E9 02                SUB    CX,2            ; Don't CRC the CRC 
  705.      653 045D  32 E4                XOR    AH,AH            ; Always zero 
  706.      654 045F  33 DB                XOR    BX,BX            ; Start with zero 
  707.      655 0461  33 F6                XOR    SI,SI            ; Buffer offset zero 
  708.      656 0463  51            CRC0:    PUSH    CX            ; Save count 
  709.      657 0464  AC                LODSB                ; Get byte 
  710.      658 0465  03 D8                ADD    BX,AX            ; Total so far 
  711.      659 0467  83 E1 07                AND    CX,0000111B        ; Rotate max 7 bits 
  712.      660 046A  D3 C3                ROL    BX,CL            ; Multiply 
  713.      661 046C  59                POP    CX            ; Restore count 
  714.      662 046D  E2 F4                LOOP    CRC0            ; Continue 
  715.      663 046F  39 1C                CMP    WORD PTR [SI],BX    ; For checking 
  716.      664 0471  89 1C                MOV    WORD PTR [SI],BX    ; Insert CRC 
  717.      665 0473  1F                POP    DS 
  718.      666 0474  5E                POP    SI 
  719.      667 0475  59                POP    CX 
  720.      668 0476  C3                RET 
  721.      669 0477                CRC    ENDP 
  722.      670                ; 
  723.      671 0477                SET_SEG    PROC    NEAR 
  724.      672 0477  B8 0E90 R            MOV    AX,OFFSET BUFFER    ; Point to buffer 
  725.      673 047A  D1 E8                SHR    AX,1            ; /2 
  726.      674 047C  D1 E8                SHR    AX,1            ; /4 
  727.      675 047E  D1 E8                SHR    AX,1            ; /8 
  728.      676 0480  D1 E8                SHR    AX,1            ; /16 
  729.      677 0482  8C CB                MOV    BX,CS            ; Get code segment 
  730.      678 0484  03 C3                ADD    AX,BX            ; Add to offset paragraph 
  731.      679 0486  A3 09F3 R            MOV    WORD PTR [BUF_SEG],AX    ; Save for later 
  732.      680 0489  05 1000                ADD    AX,4096            ; Next segment higher 
  733.      681 048C  A3 09F5 R            MOV    WORD PTR [DAT_SEG],AX    ; Into next 
  734.      682 048F  C3                RET 
  735.      683 0490                SET_SEG    ENDP 
  736.      684                ; 
  737.      685                ;    Local extension of the clock vector. 
  738.      686                ; 
  739.      687 0490                LCL_CLK    PROC    FAR 
  740.      688 0490  FB                STI                ; Allow interrupts 
  741.      689 0491  50                PUSH    AX            ; Save registers used 
  742.      690 0492  B0 20                MOV    AL,20H            ; Non-specific end-of-interrupt 
  743.      691 0494  E6 20                OUT    20H,AL            ; Out to the controller 
  744.      692 0496  58                POP    AX            ; Restore registers used 
  745.      693 0497  2E: 83 3E 09EF R 00        CMP    WORD PTR CS:[CLOCK],0    ; See if already zero 
  746.      694 049D  74 05                JZ    CLK_EX            ; Yes, quit 
  747.      695 049F  2E: FF 0E 09EF R            DEC    WORD PTR CS:[CLOCK]    ; Bump the timer 
  748.      696 04A4  2E: FF 2E 09F7 R        CLK_EX:    JMP    DWORD PTR CS:[OLD_CLK]    ; Continue 
  749.      697 04A9                LCL_CLK    ENDP 
  750.      698                ; 
  751.      699 04A9                SET_INT    PROC    NEAR 
  752.      700 04A9  C6 06 09DF R FF            MOV    BYTE PTR [INT_FLG],0FFH    ; Show we've set up interrupts 
  753.      701 04AE  E8 030C R            CALL    CLR_BUF            ; Put pointers at correct loc 
  754.      702 04B1  8B 16 0A10 R            MOV    DX,WORD PTR [PORT]    ; Get port address 
  755. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  756. JMODEM.ASM                                                  Page     1-14
  757.  
  758.  
  759.      703 04B5  83 C2 01                ADD    DX,1            ; Interrupt enable register 
  760.      704 04B8  EC                IN    AL,DX            ; Get the control byte 
  761.      705 04B9  A2 09E6 R            MOV    BYTE PTR [STATUS],AL    ; Save interrupt status 
  762.      706 04BC  B0 09                MOV    AL,(INT_RC OR INT_MS)    ; Interrupt on rec. chr. / mod. sta. 
  763.      707 04BE  EE                OUT    DX,AL            ; Enable interrupts 
  764.      708                ; 
  765.      709 04BF  83 C2 03                ADD    DX,3            ; Offset to modem control register 
  766.      710 04C2  B0 0B                MOV    AL,RTS_DTR OR TRISTAT    ; Get control byte 
  767.      711 04C4  EE                OUT    DX,AL            ; Output the byte 
  768.      712 04C5  83 C2 02                ADD    DX,2            ; Offset to modem status 
  769.      713 04C8  EC                IN    AL,DX            ; Get modem status 
  770.      714 04C9  A2 09E8 R            MOV    BYTE PTR [MOD_STA],AL    ; Save the modem status 
  771.      715 04CC  8A E0                MOV    AH,AL            ; Duplicate 
  772.      716 04CE  80 E4 80                AND    AH,RLSD            ; Mask all but carrier det 
  773.      717 04D1  88 26 09E5 R            MOV    BYTE PTR [WASC],AH    ; Save carrier status 
  774.      718 04D5  24 30                AND    AL,CTSDSR        ; Mask all but CTS/DSR 
  775.      719 04D7  A2 09E4 R            MOV    BYTE PTR [ENABLE],AL    ; Save data enable byte 
  776.      720                ; 
  777.      721 04DA  06                PUSH    ES            ; Save segment 
  778.      722 04DB  A0 0A12 R            MOV    AL,BYTE PTR [COM_INT]    ; COM interrupt 
  779.      723 04DE  B4 35                MOV    AH,35H            ; Get interrupt vector 
  780.      724 04E0  CD 21                INT    MS_DOS            ; Go get it 
  781.      725 04E2  8C 06 0A05 R            MOV    WORD PTR [UAR_SEG],ES    ; Store UART segment 
  782.      726 04E6  89 1E 0A03 R            MOV    WORD PTR [UAR_OFF],BX    ; Store UART offset 
  783.      727                ; 
  784.      728 04EA  B0 1C                MOV    AL,1CH            ; Clock interrupt 
  785.      729 04EC  B4 35                MOV    AH,35H            ; Get interrupt vector 
  786.      730 04EE  CD 21                INT    MS_DOS            ; Go get it 
  787.      731 04F0  8C 06 09F9 R            MOV    WORD PTR [CLK_SEG],ES    ; Store clock segment 
  788.      732 04F4  89 1E 09F7 R            MOV    WORD PTR [CLK_OFF],BX    ; Store clock offset 
  789.      733                ; 
  790.      734 04F8  B0 1B                MOV    AL,1BH            ; Control break interrupt 
  791.      735 04FA  B4 35                MOV    AH,35H            ; Get interrupt vector 
  792.      736 04FC  CD 21                INT    MS_DOS            ; Go get it 
  793.      737 04FE  8C 06 09FD R            MOV    WORD PTR [BRK_SEG],ES    ; Store clock segment 
  794.      738 0502  89 1E 09FB R            MOV    WORD PTR [BRK_OFF],BX    ; Store clock offset 
  795.      739                ; 
  796.      740 0506  B0 23                MOV    AL,23H            ; Control C interrupt 
  797.      741 0508  B4 35                MOV    AH,35H            ; Get interrupt vector 
  798.      742 050A  CD 21                INT    MS_DOS            ; Go get it 
  799.      743 050C  8C 06 0A01 R            MOV    WORD PTR [CTC_SEG],ES    ; Store clock segment 
  800.      744 0510  89 1E 09FF R            MOV    WORD PTR [CTC_OFF],BX    ; Store clock offset 
  801.      745 0514  07                POP    ES            ; Restore segment 
  802.      746                ; 
  803.      747 0515  A0 0A12 R            MOV    AL,BYTE PTR [COM_INT]    ; Communications vector 
  804.      748 0518  B4 25                MOV    AH,25H            ; Set interrupt vector 
  805.      749 051A  BA 02BC R            MOV    DX,OFFSET EASY_INT    ; Our local vector 
  806.      750 051D  CD 21                INT    MS_DOS            ; Go set it 
  807.      751                ; 
  808.      752 051F  E4 21                IN    AL,INT_CTL        ; Get interrupt control mask 
  809.      753 0521  A2 0A07 R            MOV    BYTE PTR [OLD_MASK],AL    ; Save the mask. 
  810.      754 0524  22 06 0A13 R            AND    AL,BYTE PTR [COM_MSK]    ; Set the mask 
  811.      755 0528  E6 21                OUT    INT_CTL,AL        ; Set the mask 
  812.      756                ; 
  813. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  814. JMODEM.ASM                                                  Page     1-15
  815.  
  816.  
  817.      757 052A  B0 1C                MOV    AL,1CH            ; Clock vector 
  818.      758 052C  B4 25                MOV    AH,25H            ; Set interrupt vector 
  819.      759 052E  BA 0490 R            MOV    DX,OFFSET LCL_CLK    ; Our local vector 
  820.      760 0531  CD 21                INT    MS_DOS            ; Go set it 
  821.      761                ; 
  822.      762 0533  B0 1B                MOV    AL,1BH            ; Control break vector 
  823.      763 0535  B4 25                MOV    AH,25H            ; Set interrupt vector 
  824.      764 0537  BA 07F5 R            MOV    DX,OFFSET BRK        ; Our local vector 
  825.      765 053A  CD 21                INT    MS_DOS            ; Go set it 
  826.      766                ; 
  827.      767 053C  B0 23                MOV    AL,23H            ; Control C vector 
  828.      768 053E  B4 25                MOV    AH,25H            ; Set interrupt vector 
  829.      769 0540  BA 07F5 R            MOV    DX,OFFSET BRK        ; Our local vector 
  830.      770 0543  CD 21                INT    MS_DOS            ; Go set it 
  831.      771 0545  B0 20                MOV    AL,20H            ; Non-specific end-of-interrupt 
  832.      772 0547  E6 20                OUT    20H,AL            ; Reset controller 
  833.      773 0549  C3                RET 
  834.      774 054A                SET_INT    ENDP 
  835.      775                ; 
  836.      776 054A                RES_INT    PROC    NEAR 
  837.      777 054A  80 3E 09DF R 00            CMP    BYTE PTR [INT_FLG],0    ; See if we have hot Interrupts 
  838.      778 054F  75 01                JNZ    HOT_IN            ; Yes 
  839.      779 0551  C3                RET                ; No, don't "restore" them 
  840.      780 0552  E8 0344 R        HOT_IN:    CALL    EAT            ; Clear receive buffer. 
  841.      781 0555  C6 06 09DF R 00            MOV    BYTE PTR [INT_FLG],0    ; Show we are doing it now 
  842.      782 055A  8B 16 0A10 R            MOV    DX,WORD PTR [PORT]    ; Get port address 
  843.      783 055E  83 C2 01                ADD    DX,1            ; Interrupt enable register 
  844.      784 0561  A0 09E6 R            MOV    AL,BYTE PTR [STATUS]    ; Get old UART status 
  845.      785 0564  EE                OUT    DX,AL            ; Restore it 
  846.      786                ; 
  847.      787 0565  A0 0A07 R            MOV    AL,BYTE PTR [OLD_MASK]    ; Get old Interrupt/ctl mask 
  848.      788 0568  E6 21                OUT    INT_CTL,AL        ; Restore it 
  849.      789                ; 
  850.      790 056A  1E                PUSH    DS            ; Save segment 
  851.      791 056B  A0 0A12 R            MOV    AL,BYTE PTR [COM_INT]    ; Vector to restore 
  852.      792 056E  B4 25                MOV    AH,25H            ; Set interrupt function 
  853.      793 0570  2E: C5 16 0A03 R            LDS    DX,CS:[OLD_UART]    ; Pick up old vector 
  854.      794 0575  CD 21                INT    MS_DOS            ; Restore it 
  855.      795                ; 
  856.      796 0577  B0 1C                MOV    AL,1CH            ; Vector to restore 
  857.      797 0579  B4 25                MOV    AH,25H            ; Set interrupt function 
  858.      798 057B  2E: C5 16 09F7 R            LDS    DX,CS:[OLD_CLK]        ; Pick up old vector 
  859.      799 0580  CD 21                INT    MS_DOS            ; Restore it 
  860.      800                ; 
  861.      801 0582  B4 25                MOV    AH,25H            ; Set interrupt function 
  862.      802 0584  B0 1B                MOV    AL,1BH            ; Control break vector 
  863.      803 0586  2E: C5 16 09FB R            LDS    DX,CS:[OLD_BRK]        ; Pick up old vector 
  864.      804 058B  CD 21                INT    MS_DOS            ; Restore it 
  865.      805                ; 
  866.      806 058D  B4 25                MOV    AH,25H            ; Set interrupt function 
  867.      807 058F  B0 23                MOV    AL,23H            ; Control C vector 
  868.      808 0591  2E: C5 16 09FF R            LDS    DX,CS:[OLD_CTC]        ; Pick up old vector 
  869.      809 0596  CD 21                INT    MS_DOS            ; Restore it 
  870.      810 0598  1F                POP    DS 
  871. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  872. JMODEM.ASM                                                  Page     1-16
  873.  
  874.  
  875.      811 0599  B0 20                MOV    AL,20H            ; Non-specific end-of-interrupt 
  876.      812 059B  E6 20                OUT    20H,AL            ; Reset controller 
  877.      813 059D  C3                RET 
  878.      814 059E                RES_INT    ENDP 
  879.      815                ; 
  880.      816                ;    Open a fiile for reading. 
  881.      817                ; 
  882.      818 059E                OPEN_R    PROC    NEAR 
  883.      819 059E  B8 3D00                MOV    AX,3D00H        ; Open for read 
  884.      820 05A1  33 C9                XOR    CX,CX            ; Normal file 
  885.      821 05A3  BA 0CFA R            MOV    DX,OFFSET FNAME        ; File name 
  886.      822 05A6  CD 21                INT    MS_DOS 
  887.      823 05A8  A3 09F1 R            MOV    WORD PTR [HANDLE],AX    ; Save handle/error code 
  888.      824 05AB  73 13                JNC    OPN_OK 
  889.      825 05AD  BE 0C2B R            MOV    SI,OFFSET PRP4        ; Point to prompt 
  890.      826 05B0  E8 03D9 R            CALL    PROMPT            ; Print to screen 
  891.      827 05B3  BE 0CFA R            MOV    SI,OFFSET FNAME        ; Point to filename 
  892.      828 05B6  E8 03D9 R            CALL    PROMPT            ; Print to screen 
  893.      829 05B9  BE 0C3D R            MOV    SI,OFFSET PRP5        ; End of the string 
  894.      830 05BC  E8 03D9 R            CALL    PROMPT 
  895.      831 05BF  F9                STC                ; Maintain error status 
  896.      832 05C0  C3            OPN_OK:    RET 
  897.      833 05C1                OPEN_R    ENDP 
  898.      834                ; 
  899.      835 05C1                OPEN_W    PROC    NEAR 
  900.      836 05C1  B8 3D00                MOV    AX,3D00H        ; Open for read 
  901.      837 05C4  33 C9                XOR    CX,CX            ; Normal file 
  902.      838 05C6  BA 0CFA R            MOV    DX,OFFSET FNAME        ; File name 
  903.      839 05C9  CD 21                INT    MS_DOS 
  904.      840 05CB  A3 09F1 R            MOV    WORD PTR [HANDLE],AX    ; Save handle/error code 
  905.      841 05CE  72 31                JC    CREATE            ; Not found, create one. 
  906.      842 05D0  E8 0624 R            CALL    CLOSE            ; File was found, close it 
  907.      843 05D3  BE 0CFA R            MOV    SI,OFFSET FNAME        ; Present file name 
  908.      844 05D6  BF 0D3A R            MOV    DI,OFFSET ONAME        ; New name to '.old' 
  909.      845 05D9  B9 0040                MOV    CX,64            ; Max characters 
  910.      846 05DC  AC            NFILE0:    LODSB                ; Get byte 
  911.      847 05DD  3C 2E                CMP    AL,'.'            ; Find the delimiter? 
  912.      848 05DF  75 0A                JNZ    NODOT 
  913.      849 05E1  AA                STOSB                ; Put in the dot 
  914.      850 05E2  B0 4F                MOV    AL,'O'            ; Get a 'O' for old 
  915.      851 05E4  AA                STOSB                ; Save 
  916.      852 05E5  B8 444C                MOV    AX,'DL'            ; 'LD' backwards 
  917.      853 05E8  AB                STOSW                ; Save in string 
  918.      854 05E9  EB 03                JMP    SHORT NFILE1 
  919.      855 05EB  AA            NODOT:    STOSB 
  920.      856 05EC  E2 EE                LOOP    NFILE0            ; Continue for the whole name 
  921.      857 05EE  B8 4100            NFILE1:    MOV    AX,4100H        ; Delete file function 
  922.      858 05F1  BA 0D3A R            MOV    DX,OFFSET ONAME        ; Delete any such old name 
  923.      859 05F4  CD 21                INT    MS_DOS            ; Do it, ignore any errors 
  924.      860 05F6  B8 5600                MOV    AX,5600H        ; Rename file 
  925.      861 05F9  BA 0CFA R            MOV    DX,OFFSET FNAME        ; File to be renamed 
  926.      862 05FC  BF 0D3A R            MOV    DI,OFFSET ONAME        ; What to name it to 
  927.      863 05FF  CD 21                INT    MS_DOS            ; Rename the file 
  928.      864 0601  B8 3C00            CREATE:    MOV    AX,3C00H        ; Create file 
  929. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  930. JMODEM.ASM                                                  Page     1-17
  931.  
  932.  
  933.      865 0604  BA 0CFA R            MOV    DX,OFFSET FNAME        ; File to create 
  934.      866 0607  33 C9                XOR    CX,CX            ; Normal attribute 
  935.      867 0609  CD 21                INT    MS_DOS            ; Create it 
  936.      868 060B  A3 09F1 R            MOV    WORD PTR [HANDLE],AX    ; Save handle/error 
  937.      869 060E  73 13                JNC    CREOK 
  938.      870 0610  BE 0C2B R            MOV    SI,OFFSET PRP4        ; Point to prompt 
  939.      871 0613  E8 03D9 R            CALL    PROMPT 
  940.      872 0616  BE 0CFA R            MOV    SI,OFFSET FNAME        ; Point to filename 
  941.      873 0619  E8 03D9 R            CALL    PROMPT            ; Print to screen 
  942.      874 061C  BE 0C49 R            MOV    SI,OFFSET PRP6        ; End of the string 
  943.      875 061F  E8 03D9 R            CALL    PROMPT 
  944.      876 0622  F9                STC                ; Maintain error status 
  945.      877 0623  C3            CREOK:    RET 
  946.      878 0624                OPEN_W    ENDP 
  947.      879                ; 
  948.      880 0624                CLOSE    PROC    NEAR 
  949.      881 0624  B8 3E00                MOV    AX,3E00H        ; Close file function 
  950.      882 0627  8B 1E 09F1 R            MOV    BX,WORD PTR [HANDLE]    ; Get file handle 
  951.      883 062B  CD 21                INT    MS_DOS 
  952.      884 062D  C3                RET 
  953.      885 062E                CLOSE    ENDP 
  954.      886                ; 
  955.      887                ;    Read the file open for reading into the buffer. 
  956.      888                ; 
  957.      889 062E                READ    PROC    NEAR 
  958.      890 062E  80 3E 09ED R 0A            CMP    BYTE PTR [TRIES],MAX    ; No retries? 
  959.      891 0633  75 10                JNZ    NOUP 
  960.      892 0635  81 3E 09EB R 2000        CMP    WORD PTR [BYTES],8192    ; Check upper limit 
  961.      893 063B  73 16                JNC    NODWN            ; Don't add more 
  962.      894 063D  81 06 09EB R 0200        ADD    WORD PTR [BYTES],512    ; Send more bytes 
  963.      895 0643  EB 0E                JMP    SHORT NODWN        ; Continue 
  964.      896 0645  81 3E 09EB R 0200    NOUP:    CMP    WORD PTR [BYTES],512    ; Already the lowest? 
  965.      897 064B  74 06                JZ    NODWN 
  966.      898 064D  81 2E 09EB R 0200        SUB    WORD PTR [BYTES],512    ; Get/send fewer bytes 
  967.      899                ; 
  968.      900 0653  8B 0E 09EB R        NODWN:    MOV    CX,WORD PTR [BYTES]    ; Get Bytes to read 
  969.      901 0657  8B 1E 09F1 R            MOV    BX,WORD PTR [HANDLE]    ; Get open file handle 
  970.      902 065B  B8 3F00                MOV    AX,3F00H        ; Read file/device 
  971.      903 065E  1E                PUSH    DS            ; Save segment 
  972.      904 065F  8E 1E 09F3 R            MOV    DS,WORD PTR [BUF_SEG]    ; Pick up segment for output data 
  973.      905 0663  BA 0004                MOV    DX,IDATA        ; Offset of the data 
  974.      906 0666  CD 21                INT    MS_DOS            ; Read the data 
  975.      907 0668  C6 06 0002 01            MOV   BYTE PTR DS:[CTRL],NORMAL    ; Assume normal read 
  976.      908 066D  3B C1                CMP    AX,CX            ; Check for end of file 
  977.      909 066F  74 0B                JZ    NORM            ; Was not the end of file 
  978.      910 0671  80 0E 0002 04            OR    BYTE PTR DS:[CTRL],EOF    ; Is the end of file 
  979.      911 0676  26: C6 06 09E7 R 04        MOV    BYTE PTR ES:[FEND],EOF    ; Local info also 
  980.      912 067C  8B C8            NORM:    MOV    CX,AX            ; Save real byte count 
  981.      913 067E  05 0006                ADD    AX,6            ; Overhead 
  982.      914 0681  A3 0000                MOV    WORD PTR DS:[LEN],AX    ; Bytes to transmit 
  983.      915                ; 
  984.      916 0684  06                PUSH    ES            ; Save segment 
  985.      917 0685  1E                PUSH    DS 
  986.      918 0686  07                POP    ES            ; ES=DS 
  987. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  988. JMODEM.ASM                                                  Page     1-18
  989.  
  990.  
  991.      919 0687  51                PUSH    CX            ; Save byte count for now 
  992.      920 0688  8B C1                MOV    AX,CX            ; Count to encode 
  993.      921 068A  BE 0004                MOV    SI,IDATA        ; Where the data is 
  994.      922 068D  BF 4000                MOV    DI,CODELOC        ; Where to put coded data 
  995.      923 0690  E8 072C R            CALL    ENCODE            ; Encode the data 
  996.      924 0693  59                POP    CX            ; Restore original byte count 
  997.      925 0694  3B C1                CMP    AX,CX            ; Check to see if new is less 
  998.      926 0696  73 1C                JNC    READ0            ; Not less 
  999.      927                ; 
  1000.      928 0698  51                PUSH    CX            ; Save original byte count 
  1001.      929 0699  8B C8                MOV    CX,AX            ; New byte count 
  1002.      930 069B  BE 4000                MOV    SI,CODELOC        ; When compressed data is 
  1003.      931 069E  BF 0004                MOV    DI,IDATA        ; Where to put compressed data 
  1004.      932 06A1  F3/ A4                REP    MOVSB            ; Copy the data 
  1005.      933 06A3  05 0006                ADD    AX,6            ; Add in overhead 
  1006.      934 06A6  A3 0000                MOV    WORD PTR DS:[LEN],AX    ; Bytes to actually transmit 
  1007.      935 06A9  80 26 0002 FE            AND   BYTE PTR DS:[CTRL],NONORM    ; Reset, normal bit 
  1008.      936 06AE  80 0E 0002 02            OR    BYTE PTR DS:[CTRL],COMP    ; Show its encoded 
  1009.      937 06B3  59                POP    CX            ; Restore original byte count 
  1010.      938                ; 
  1011.      939 06B4  07            READ0:    POP    ES            ; Restore segments 
  1012.      940 06B5  1F                POP    DS 
  1013.      941 06B6  01 0E 09E2 R            ADD    WORD PTR [CNT_LO],CX    ; Add to the count 
  1014.      942 06BA  83 16 09E0 R 00            ADC    WORD PTR [CNT_HI],0    ; Take care of overflow. 
  1015.      943 06BF  FF 06 09E9 R            INC    WORD PTR [REC_NOL]    ; Next record number 
  1016.      944 06C3  C3                RET 
  1017.      945 06C4                READ    ENDP 
  1018.      946                ; 
  1019.      947                ;    Write the buffer contents to the file 
  1020.      948                ; 
  1021.      949 06C4                WRITE    PROC    NEAR 
  1022.      950 06C4  1E                PUSH    DS 
  1023.      951 06C5  8E 1E 09F3 R            MOV    DS,WORD PTR [BUF_SEG]    ; Where the data is 
  1024.      952 06C9  BA 0004                MOV    DX,IDATA        ; Offset for data 
  1025.      953 06CC  8B 0E 0000            MOV    CX,WORD PTR DS:[LEN]    ; Get string length 
  1026.      954 06D0  83 E9 06                SUB    CX,6            ; Remove overhead 
  1027.      955 06D3  F6 06 0002 02            TEST  BYTE PTR DS:[CTRL],COMP    ; Check for compressed data 
  1028.      956 06D8  74 13                JZ    WRITE0            ; Its normal, not compressed 
  1029.      957 06DA  06                PUSH    ES            ; Save segment 
  1030.      958 06DB  1E                PUSH    DS 
  1031.      959 06DC  07                POP    ES            ; ES=DS 
  1032.      960 06DD  8B F2                MOV    SI,DX            ; Location of the string 
  1033.      961 06DF  BF 4000                MOV    DI,CODELOC        ; Where to put the decoded data 
  1034.      962 06E2  8B C1                MOV    AX,CX            ; String length 
  1035.      963 06E4  E8 070F R            CALL    DECODE            ; Decode the data 
  1036.      964 06E7  8B C8                MOV    CX,AX            ; New string length 
  1037.      965 06E9  BA 4000                MOV    DX,CODELOC        ; Where the data is 
  1038.      966 06EC  07                POP    ES            ; Restore segment 
  1039.      967 06ED  2E: 8B 1E 09F1 R        WRITE0:    MOV    BX,WORD PTR CS:[HANDLE]    ; Get the file access word 
  1040.      968 06F2  B8 4000                MOV    AX,4000H        ; Write to file/device 
  1041.      969 06F5  CD 21                INT    MS_DOS 
  1042.      970 06F7  1F                POP    DS 
  1043.      971 06F8  9C                PUSHF                ; Save write status 
  1044.      972 06F9  89 0E 09EB R            MOV    WORD PTR [BYTES],CX    ; For 'SHOW' routine 
  1045. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  1046. JMODEM.ASM                                                  Page     1-19
  1047.  
  1048.  
  1049.      973 06FD  01 0E 09E2 R            ADD    WORD PTR [CNT_LO],CX    ; Add to the count 
  1050.      974 0701  83 16 09E0 R 00            ADC    WORD PTR [CNT_HI],0    ; Take care of overflow. 
  1051.      975 0706  FF 06 09E9 R            INC    WORD PTR [REC_NOL]    ; Next record number 
  1052.      976 070A  E8 07FC R            CALL    SHOW 
  1053.      977 070D  9D                POPF                ; Restore write status 
  1054.      978 070E  C3                RET 
  1055.      979 070F                WRITE    ENDP 
  1056.      980                ; 
  1057.      981                ; 
  1058.      982                ;    Decode compressed string in DS:SI and transfer to ES:DI 
  1059.      983                ;    Input string length is in AX, output string length in AX 
  1060.      984                ; 
  1061.      985 070F                DECODE    PROC    NEAR 
  1062.      986 070F  57                PUSH    DI            ; SAVE START ADDRESS 
  1063.      987 0710  8B DE                MOV    BX,SI            ; GET STARTING OFFSET 
  1064.      988 0712  03 D8                ADD    BX,AX            ; CALC END OF STRING OFFSET 
  1065.      989 0714  AC            DECD0:    LODSB                ; GET BYTE 
  1066.      990 0715  3C BB                CMP    AL,0BBH            ; SENTINEL ? 
  1067.      991 0717  75 08                JNZ    DECD1            ; NO 
  1068.      992 0719  AD                LODSW                ; PICK UP LENGTH 
  1069.      993 071A  8B C8                MOV    CX,AX            ; UPDATE BYTE COUNT 
  1070.      994 071C  AC                LODSB                ; GET REPEAT CHARACTER 
  1071.      995 071D  F3/ AA                REP    STOSB            ; FILL IN CHARACTER 
  1072.      996 071F  EB 01                JMP    SHORT DECD2        ; AND CONTINUE 
  1073.      997 0721  AA            DECD1:    STOSB                ; TRANSFER BYTE 
  1074.      998 0722  3B F3            DECD2:    CMP    SI,BX            ; END OF STRING? 
  1075.      999 0724  72 EE                JC    DECD0            ; NOT YET 
  1076.     1000 0726  8B C7                MOV    AX,DI            ; GET ENDING STRING OFFSET 
  1077.     1001 0728  5F                POP    DI            ; RESTORE START ADDRESS 
  1078.     1002 0729  2B C7                SUB    AX,DI            ; SUBTRACT START 
  1079.     1003 072B  C3                RET                ; AX = BYTE COUNT 
  1080.     1004 072C                DECODE    ENDP 
  1081.     1005                ; 
  1082.     1006                ;    Encode string in DS:SI. Output string in ES:DI. Upon input 
  1083.     1007                ;    AX = Byte count. Upon output AX = new string length 
  1084.     1008                ; 
  1085.     1009 072C                ENCODE    PROC    NEAR 
  1086.     1010 072C  52                PUSH    DX 
  1087.     1011 072D  57                PUSH    DI            ; SAVE OUTPUT STRING LOC 
  1088.     1012 072E  03 C6                ADD    AX,SI            ; CALC LAST ADDRESS 
  1089.     1013 0730  8B D0                MOV    DX,AX            ; SAVE LAST ADDESSS 
  1090.     1014 0732  AC            ENCD0:    LODSB                ; GET BYTE 
  1091.     1015 0733  56                PUSH    SI            ; SAVE SOURCE INDEX 
  1092.     1016 0734  57                PUSH    DI            ; SAVE DEST INDEX 
  1093.     1017 0735  8B CA                MOV    CX,DX            ; GET LAST POSSIBLE ADDRESS 
  1094.     1018 0737  2B CE                SUB    CX,SI            ; SUBTRACT PRESENT ADDRESS 
  1095.     1019 0739  41                INC    CX            ; ADD ONE 
  1096.     1020                ; 
  1097.     1021 073A  8B FE                MOV    DI,SI            ; FOR SEARCH DI=POINTER 
  1098.     1022 073C  F3/ AE                REPZ    SCASB            ; SEE HOW MANY THERE ARE 
  1099.     1023 073E  8B DF                MOV    BX,DI            ; GET LAST ADDRESS 
  1100.     1024                ; 
  1101.     1025 0740  5F                POP    DI            ; RESTORE REGISTERS 
  1102.     1026 0741  5E                POP    SI 
  1103. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  1104. JMODEM.ASM                                                  Page     1-20
  1105.  
  1106.  
  1107.     1027 0742  2B DE                SUB    BX,SI            ; BX = BYTE COUNT 
  1108.     1028 0744  3C BB                CMP    AL,0BBH            ; WAS IT THE SENTINEL? 
  1109.     1029 0746  74 05                JZ    ENCD1            ; YES, REQUIRES ENCODING 
  1110.     1030 0748  83 FB 04                CMP    BX,4            ; ENOUGH TO COMPACT? 
  1111.     1031 074B  72 0B                JC    NOENC            ; NO, DON'T ENCODE 
  1112.     1032 074D  50            ENCD1:    PUSH    AX            ; SAVE BYTE 
  1113.     1033 074E  B0 BB                MOV    AL,0BBH            ; SENTINEL 
  1114.     1034 0750  AA                STOSB                ; PUT IN OUTPUT BUFFER 
  1115.     1035 0751  8B C3                MOV    AX,BX            ; BYTE COUNT 
  1116.     1036 0753  AB                STOSW                ; INTO BUFFER 
  1117.     1037 0754  58                POP    AX            ; RESTORE SAVED BYTE 
  1118.     1038 0755  4B                DEC    BX            ; LODSB INCREMENTED IT ONCE 
  1119.     1039 0756  03 F3                ADD    SI,BX            ; UPDATE SOURCE 
  1120.     1040 0758  AA            NOENC:    STOSB                ; SAVE BYTE 
  1121.     1041 0759  3B F2            ENCD2:    CMP    SI,DX            ; CHECK LIMITS 
  1122.     1042 075B  72 D5                JC    ENCD0            ; CONTINUE 
  1123.     1043 075D  8B C7            ENCD3:    MOV    AX,DI            ; GET LAST ADDRESS 
  1124.     1044 075F  5F                POP    DI            ; RESTORE START ADDRESS 
  1125.     1045 0760  2B C7                SUB    AX,DI            ; CALC BYTE COUNT 
  1126.     1046 0762  5A                POP    DX 
  1127.     1047 0763  C3                RET 
  1128.     1048 0764                ENCODE    ENDP 
  1129.     1049                ; 
  1130.     1050                ;    Parse the command line to extract filename and function. 
  1131.     1051                ; 
  1132.     1052 0764                PARSE    PROC    NEAR 
  1133.     1053 0764  BE 0E90 R            MOV    SI,OFFSET COMINIT    ; Assume COM1 
  1134.     1054 0767  BF 0A10 R            MOV    DI,OFFSET PORT        ; Where to put the data 
  1135.     1055 076A  B9 0004 90            MOV    CX,CLEN            ; Length of string to move 
  1136.     1056 076E  F3/ A4                REP    MOVSB            ; Fill the table 
  1137.     1057 0770  BE 0080                MOV    SI,80H 
  1138.     1058 0773  AC                LODSB                ; Get bytes typed 
  1139.     1059 0774  3C 03                CMP    AL,3            ; Nothing? 
  1140.     1060 0776  72 22                JC    PARSEX            ; Yes, nothing typed 
  1141.     1061 0778  98                CBW 
  1142.     1062 0779  8B C8                MOV    CX,AX            ; Use as a count 
  1143.     1063 077B  E8 07DE R            CALL    MAP            ; Map to upper case 
  1144.     1064 077E  49                DEC    CX 
  1145.     1065 077F  49                DEC    CX 
  1146.     1066 0780  AC            PARSE0:    LODSB                ; Get byte 
  1147.     1067 0781  3C 20                CMP    AL,' '            ; Is it a space (or less) 
  1148.     1068 0783  76 04                JBE    PARSE1            ; Space found 
  1149.     1069 0785  E2 F9                LOOP    PARSE0            ; None, continue 
  1150.     1070 0787  EB 11                JMP    SHORT PARSEX        ; Not found, exit with error 
  1151.     1071                ; 
  1152.     1072 0789  80 3C 20            PARSE1:    CMP    BYTE PTR [SI],' '    ; Check next byte 
  1153.     1073 078C  76 F2                JBE    PARSE0            ; Yes 
  1154.     1074 078E  AC                LODSB                ; Get the byte 
  1155.     1075 078F  49                DEC    CX            ; Byte count 
  1156.     1076 0790  E3 08                JCXZ    PARSEX            ; Ran out of characters 
  1157.     1077 0792  3C 52                CMP    AL,'R'            ; Was it a [R]eceive? 
  1158.     1078 0794  74 06                JZ    YES            ; Yes 
  1159.     1079 0796  3C 53                CMP    AL,'S'            ; Was it a [S]end? 
  1160.     1080 0798  74 02                JZ    YES            ; Yes 
  1161. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  1162. JMODEM.ASM                                                  Page     1-21
  1163.  
  1164.  
  1165.     1081 079A  F9            PARSEX:    STC                ; Show error and exit 
  1166.     1082 079B  C3                RET 
  1167.     1083                ; 
  1168.     1084 079C  A2 09EE R        YES:    MOV    BYTE PTR [RXTX],AL    ; Save flag 
  1169.     1085 079F  80 3C 20                CMP    BYTE PTR [SI],' '    ; More spaces? 
  1170.     1086 07A2  76 26                JBE    PARSE2            ; Filter them all 
  1171.     1087 07A4  AC                LODSB                ; Get port 
  1172.     1088 07A5  49                DEC    CX            ; Bump byte count 
  1173.     1089 07A6  E3 F2                JCXZ    PARSEX            ; Ran out of bytes 
  1174.     1090 07A8  2C 30                SUB    AL,'0'            ; Remove ASCII bias 
  1175.     1091 07AA  76 1E                JBE    PARSE2            ; Lower limit 
  1176.     1092 07AC  3C 04                CMP    AL,4            ; Check upper limit 
  1177.     1093 07AE  7F 1A                JG    PARSE2            ; Out of limits 
  1178.     1094 07B0  FE C8                DEC    AL            ; COM one = offset zero 
  1179.     1095 07B2  32 E4                XOR    AH,AH            ; Zero high byte 
  1180.     1096 07B4  D1 E0                SHL    AX,1            ; Times two 
  1181.     1097 07B6  D1 E0                SHL    AX,1            ; Times four 
  1182.     1098 07B8  56                PUSH    SI            ; Save command line location 
  1183.     1099 07B9  BE 0E90 R            MOV    SI,OFFSET COMINIT    ; Where the table 
  1184.     1100 07BC  03 F0                ADD    SI,AX            ; Offset for COM1,,,4 
  1185.     1101 07BE  BF 0A10 R            MOV    DI,OFFSET PORT        ; Runtime parameters 
  1186.     1102 07C1  51                PUSH    CX            ; Save count 
  1187.     1103 07C2  B9 0004 90            MOV    CX,CLEN            ; Four bytes 
  1188.     1104 07C6  F3/ A4                REP    MOVSB            ; Insert new parameters 
  1189.     1105 07C8  59                POP    CX            ; Restore count 
  1190.     1106 07C9  5E                POP    SI            ; Restore command line location 
  1191.     1107 07CA  AC            PARSE2:    LODSB 
  1192.     1108 07CB  3C 20                CMP    AL,' '            ; Look for another space 
  1193.     1109 07CD  76 04                JBE    PARSE3 
  1194.     1110 07CF  E2 F9                LOOP    PARSE2 
  1195.     1111 07D1  EB C7                JMP    SHORT PARSEX        ; No more spaces 
  1196.     1112                ; 
  1197.     1113 07D3  80 3C 20            PARSE3:    CMP    BYTE PTR [SI],' '    ; More spaces? 
  1198.     1114 07D6  76 F2                JBE    PARSE2            ; Filter them all 
  1199.     1115 07D8  BF 0CFA R            MOV    DI,OFFSET FNAME        ; We got to the filename 
  1200.     1116 07DB  F3/ A4                REP    MOVSB            ; Copy it 
  1201.     1117 07DD  C3                RET 
  1202.     1118 07DE                PARSE    ENDP 
  1203.     1119                ; 
  1204.     1120                ;    Map string addressed by SI to upper case. CX = byte count. 
  1205.     1121                ; 
  1206.     1122 07DE                MAP    PROC    NEAR 
  1207.     1123 07DE  51                PUSH    CX 
  1208.     1124 07DF  56                PUSH    SI 
  1209.     1125 07E0  57                PUSH    DI 
  1210.     1126 07E1  8B FE                MOV    DI,SI            ; Copy for same offset 
  1211.     1127 07E3  AC            MAP0:    LODSB                ; Get byte 
  1212.     1128 07E4  3C 7A                CMP    AL,'z'            ; Check upper limit 
  1213.     1129 07E6  77 06                JA    MAP1            ; Not a lower case character 
  1214.     1130 07E8  3C 61                CMP    AL,'a'            ; Check lower limit 
  1215.     1131 07EA  72 02                JB    MAP1            ; Not a lower case character 
  1216.     1132 07EC  24 5F                AND    AL,95            ; Reset lower case bits 
  1217.     1133 07EE  AA            MAP1:    STOSB                ; Replace in the string 
  1218.     1134 07EF  E2 F2                LOOP    MAP0 
  1219. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  1220. JMODEM.ASM                                                  Page     1-22
  1221.  
  1222.  
  1223.     1135 07F1  5F                POP    DI 
  1224.     1136 07F2  5E                POP    SI 
  1225.     1137 07F3  59                POP    CX 
  1226.     1138 07F4  C3                RET 
  1227.     1139 07F5                MAP    ENDP 
  1228.     1140                ; 
  1229.     1141                ;    Control Break not allowed. 
  1230.     1142                ; 
  1231.     1143 07F5                BRK    PROC    FAR 
  1232.     1144 07F5  2E: C6 06 09DD R FF        MOV    BYTE PTR CS:[KILL],0FFH    ; Set the flag. 
  1233.     1145 07FB  CF                IRET 
  1234.     1146 07FC                BRK    ENDP 
  1235.     1147                ; 
  1236.     1148 07FC                SHOW    PROC    NEAR 
  1237.     1149 07FC  33 C0                XOR    AX,AX            ; Get current time 
  1238.     1150 07FE  CD 1A                INT    1AH            ; Get the time 
  1239.     1151 0800  A1 09DB R            MOV    AX,WORD PTR [TIM_L]    ; Get Last time 
  1240.     1152 0803  89 16 09DB R            MOV    WORD PTR [TIM_L],DX    ; Save new LOW count 
  1241.     1153 0807  2B D0                SUB    DX,AX            ; Sub new LOW from old 
  1242.     1154 0809  72 03                JC    NOCY 
  1243.     1155 080B  83 C2 FF                ADD    DX,0FFFFH        ; Must have gone past the hour 
  1244.     1156 080E  8B CA            NOCY:    MOV    CX,DX            ; Save low count 
  1245.     1157 0810  75 03                JNZ    NOZER            ; Not a zero 
  1246.     1158 0812  B9 0001                MOV    CX,1            ; Make zero one 
  1247.     1159 0815  A1 09EB R        NOZER:    MOV    AX,WORD PTR [BYTES]    ; Get bytes TX/RX this time 
  1248.     1160 0818  33 D2                XOR    DX,DX            ; Ready for DIV 
  1249.     1161 081A  F7 F1                DIV    CX            ; AX = bytes / tick 
  1250.     1162 081C  B9 0013                MOV    CX,19 
  1251.     1163 081F  F7 E1                MUL    CX 
  1252.     1164                ; 
  1253.     1165 0821  06                PUSH    ES 
  1254.     1166 0822  8E 06 0A0E R            MOV    ES,WORD PTR [SCR_SEG]    ; Pick up screen segment 
  1255.     1167                ; 
  1256.     1168 0826  BF 072C                MOV    DI,SCR_CPS 
  1257.     1169 0829  33 D2                XOR    DX,DX            ; Zero high word 
  1258.     1170 082B  E8 0862 R            CALL    ASCII 
  1259.     1171 082E  B8 7020                MOV   AX,(SCRATTR SHL 8) OR 20H    ; Normal attribute and a space 
  1260.     1172 0831  AB                STOSW 
  1261.     1173                ; 
  1262.     1174 0832  A1 09E9 R            MOV    AX,WORD PTR [REC_NOL]    ; Get record number 
  1263.     1175 0835  33 D2                XOR    DX,DX            ; Set high word 
  1264.     1176 0837  BF 054C                MOV    DI,SCR_BLK        ; Where to put the data 
  1265.     1177 083A  E8 0862 R            CALL    ASCII            ; Convert 
  1266.     1178                ; 
  1267.     1179 083D  1E                PUSH    DS            ; Save segment 
  1268.     1180 083E  8E 1E 09F3 R            MOV    DS,WORD PTR [BUF_SEG]    ; Get buffer segment 
  1269.     1181 0842  A1 0000                MOV    AX,WORD PTR DS:[LEN]    ; Get bytes 
  1270.     1182 0845  1F                POP    DS            ; Restore segment 
  1271.     1183 0846  33 D2                XOR    DX,DX            ; Zero high word 
  1272.     1184 0848  BF 05EC                MOV    DI,SCR_LEN        ; Where to put the ASCII 
  1273.     1185 084B  E8 0862 R            CALL    ASCII            ; Convert to ascii 
  1274.     1186 084E  B8 7020                MOV   AX,(SCRATTR SHL 8) OR 20H    ; Normal attribute and a space 
  1275.     1187 0851  AB                STOSW 
  1276.     1188 0852  AB                STOSW 
  1277. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  1278. JMODEM.ASM                                                  Page     1-23
  1279.  
  1280.  
  1281.     1189                ; 
  1282.     1190 0853  8B 16 09E0 R            MOV    DX,WORD PTR [CNT_HI]    ; Pick up byte count 
  1283.     1191 0857  A1 09E2 R            MOV    AX,WORD PTR [CNT_LO] 
  1284.     1192 085A  BF 068C                MOV    DI,SCR_BYT        ; Where to put the data 
  1285.     1193 085D  E8 0862 R            CALL    ASCII            ; Convert to ASCII decimal 
  1286.     1194                ; 
  1287.     1195 0860  07                POP    ES 
  1288.     1196 0861  C3                RET 
  1289.     1197 0862                SHOW    ENDP 
  1290.     1198                ; 
  1291.     1199                ; Print double precision number in DX:AX. The string is addressed by DI 
  1292.     1200                ; All registers except BP are destroyed by this call. 
  1293.     1201                ; 
  1294.     1202 0862                ASCII    PROC    NEAR 
  1295.     1203 0862  BD 0000                MOV    BP,0000            ; Leading zero flag 
  1296.     1204 0865  B9 3B9A                MOV    CX,3B9AH        ; Get billions 
  1297.     1205 0868  BB CA00                MOV    BX,0CA00H 
  1298.     1206 086B  E8 08C5 R            CALL    SUBTR            ; Subtract them out 
  1299.     1207 086E  E8 08E6 R            CALL    COMMA            ; Put in a comma 
  1300.     1208 0871  B9 05F5                MOV    CX,05F5H        ; Get hundred-millions 
  1301.     1209 0874  BB E100                MOV    BX,0E100H 
  1302.     1210 0877  E8 08C5 R            CALL    SUBTR            ; Subtract them out 
  1303.     1211 087A  B9 0098                MOV    CX,0098H        ; Get ten-millions 
  1304.     1212 087D  BB 9680                MOV    BX,9680H 
  1305.     1213 0880  E8 08C5 R            CALL    SUBTR            ; Subtract them out 
  1306.     1214 0883  B9 000F                MOV    CX,000FH        ; Get millions 
  1307.     1215 0886  BB 4240                MOV    BX,4240H 
  1308.     1216 0889  E8 08C5 R            CALL    SUBTR            ; Subtract them out 
  1309.     1217 088C  E8 08E6 R            CALL    COMMA            ; Put in a comma 
  1310.     1218 088F  B9 0001                MOV    CX,0001H        ; Get hundred-thousands 
  1311.     1219 0892  BB 86A0                MOV    BX,86A0H 
  1312.     1220 0895  E8 08C5 R            CALL    SUBTR            ; Subtract them out 
  1313.     1221 0898  B9 0000                MOV    CX,0000H        ; Get ten-thousands 
  1314.     1222 089B  BB 2710                MOV    BX,2710H 
  1315.     1223 089E  E8 08C5 R            CALL    SUBTR            ; Subtract them out 
  1316.     1224 08A1  B9 0000                MOV    CX,0000H        ; Get thousands 
  1317.     1225 08A4  BB 03E8                MOV    BX,03E8H 
  1318.     1226 08A7  E8 08C5 R            CALL    SUBTR            ; Subtract them out 
  1319.     1227 08AA  E8 08E6 R            CALL    COMMA            ; Put in a comma 
  1320.     1228 08AD  B9 0000                MOV    CX,0000H        ; Get hundreds 
  1321.     1229 08B0  BB 0064                MOV    BX,0064H 
  1322.     1230 08B3  E8 08C5 R            CALL    SUBTR            ; Subtract them out 
  1323.     1231 08B6  B9 0000                MOV    CX,0000H        ; Get tens 
  1324.     1232 08B9  BB 000A                MOV    BX,000AH 
  1325.     1233 08BC  E8 08C5 R            CALL    SUBTR            ; Subtract them out 
  1326.     1234 08BF  04 30                ADD    AL,'0'            ; Add bias to residual 
  1327.     1235 08C1  B4 70                MOV    AH,SCRATTR        ; Normal attribute 
  1328.     1236 08C3  AB                STOSW                ; Put in the string 
  1329.     1237 08C4  C3                RET 
  1330.     1238                ; 
  1331.     1239 08C5  BE 002F            SUBTR:     MOV     SI,'0'-1        ; We are out of registers! 
  1332.     1240 08C8  46            SUBTR1:     INC     SI            ; Counter 
  1333.     1241 08C9  2B C3                 SUB     AX,BX            ; Dword subtraction 
  1334.     1242 08CB  1B D1                 SBB     DX,CX 
  1335. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  1336. JMODEM.ASM                                                  Page     1-24
  1337.  
  1338.  
  1339.     1243 08CD  73 F9                 JNB     SUBTR1            ; Continue until a carry 
  1340.     1244 08CF  03 C3                 ADD     AX,BX            ; One too many, add back 
  1341.     1245 08D1  13 D1                 ADC     DX,CX            ;   and the remainder 
  1342.     1246 08D3  83 FD 00                 CMP     BP,0            ; See if we printed anything yet 
  1343.     1247 08D6  75 05                 JNZ     SUBTR2            ; No, can't be a leading zero 
  1344.     1248 08D8  83 FE 30                 CMP     SI,'0'            ; See if its a zero 
  1345.     1249 08DB  74 08                 JZ     SUBTR3            ; Yes, don't print them 
  1346.     1250                ; 
  1347.     1251 08DD  45            SUBTR2:     INC    BP            ; We are now 'printing' a character 
  1348.     1252 08DE  50                 PUSH    AX            ; Save accumulator 
  1349.     1253 08DF  8B C6                 MOV    AX,SI            ; Get index 
  1350.     1254 08E1  B4 70                 MOV    AH,SCRATTR        ; Attribute byte 
  1351.     1255 08E3  AB                 STOSW                ; Put in screen memory 
  1352.     1256 08E4  58                 POP    AX            ; Restore accumulator 
  1353.     1257 08E5  C3            SUBTR3:     RET 
  1354.     1258                ; 
  1355.     1259 08E6  83 FD 00            COMMA:    CMP    BP,0            ; Any bytes printed? 
  1356.     1260 08E9  74 07                JZ    PASS            ; No, then no commas 
  1357.     1261 08EB  50                PUSH    AX            ; Yes, save 
  1358.     1262 08EC  B0 2C                MOV    AL,','            ; Get a comma 
  1359.     1263 08EE  B4 70                MOV    AH,SCRATTR        ; Attribute 
  1360.     1264 08F0  AB                STOSW                ; Into string 
  1361.     1265 08F1  58                POP    AX            ; Restore 
  1362.     1266 08F2  C3            PASS:    RET 
  1363.     1267 08F3                ASCII    ENDP 
  1364.     1268                ; 
  1365.     1269                ;    Send 10 control-Xes to remote to cause an abort. 
  1366.     1270                ; 
  1367.     1271 08F3                SENDX    PROC    NEAR 
  1368.     1272 08F3  B9 000A                MOV    CX,10            ; Bytes to send 
  1369.     1273 08F6  B0 18            SENDX0:    MOV    AL,CAN            ; Control-x 
  1370.     1274 08F8  E8 02A6 R            CALL    FORCE            ; Send (no flow control)the byte 
  1371.     1275 08FB  E2 F9                LOOP    SENDX0            ; Continue for all bytes 
  1372.     1276 08FD  C3                RET 
  1373.     1277 08FE                SENDX    ENDP 
  1374.     1278                ; 
  1375.     1279                ;    Save any information in the screen regen buffer. 
  1376.     1280                ; 
  1377.     1281 08FE                SAV_SCR    PROC    NEAR 
  1378.     1282 08FE  C6 06 09DE R FF            MOV    BYTE PTR [SCR_SAV],0FFH    ; Set entry flag 
  1379.     1283 0903  B8 0500                MOV    AX,0500H        ; Select page zero 
  1380.     1284 0906  CD 10                INT    VIDEO            ; Do it 
  1381.     1285                ; 
  1382.     1286 0908  B8 0300                MOV    AX,0300H        ; Get cursor position 
  1383.     1287 090B  BB 0000                MOV    BX,0            ; Page zero 
  1384.     1288 090E  CD 10                INT    VIDEO            ; Get the cursor position 
  1385.     1289 0910  89 16 0A0C R            MOV    WORD PTR [CUR_POS],DX    ; Save the position 
  1386.     1290                ; 
  1387.     1291 0914  B8 0200                MOV    AX,0200H        ; Set cursor position 
  1388.     1292 0917  BB 0000                MOV    BX,0            ; Page zero 
  1389.     1293 091A  BA 1A00                MOV    DX,1A00H        ; Hide off screen 
  1390.     1294 091D  CD 10                INT    VIDEO            ; Set the position 
  1391.     1295                ; 
  1392.     1296 091F  1E                PUSH    DS            ; Save data segment 
  1393. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  1394. JMODEM.ASM                                                  Page     1-25
  1395.  
  1396.  
  1397.     1297 0920  8E 1E 0A0E R            MOV    DS,WORD PTR [SCR_SEG]    ; Pick up screen segment 
  1398.     1298 0924  BE 03F6                MOV    SI,ORIGIN        ; Where we will put logo 
  1399.     1299 0927  BF 0AB5 R            MOV    DI,OFFSET SCR_BUF    ; Where to save the data 
  1400.     1300 092A  B9 0007                MOV    CX,7            ; Lines to save 
  1401.     1301 092D  51            SAV0:    PUSH    CX            ; Save count 
  1402.     1302 092E  B9 0017                MOV    CX,LINLEN        ; Length of line 
  1403.     1303 0931  F3/ A5                REP    MOVSW            ; Copy to buffer 
  1404.     1304 0933  83 C6 72                ADD    SI,160 - (LINLEN *2)    ; Next line 
  1405.     1305 0936  59                POP    CX            ; Restore count 
  1406.     1306 0937  E2 F4                LOOP    SAV0            ; Continue for all lines 
  1407.     1307 0939  1F                POP    DS            ; Restore segment 
  1408.     1308 093A  C3                RET 
  1409.     1309 093B                SAV_SCR    ENDP 
  1410.     1310                ; 
  1411.     1311                ;    Restore saved bytes/attributes to the screen regen buffer 
  1412.     1312                ; 
  1413.     1313 093B                RES_SCR    PROC    NEAR 
  1414.     1314 093B  80 3E 09DE R 00            CMP    BYTE PTR [SCR_SAV],0    ; Did we save the screen? 
  1415.     1315 0940  75 01                JNZ    RESIT            ; Yes 
  1416.     1316 0942  C3                RET                ; No, don't restore 
  1417.     1317 0943  C6 06 09DE R 00        RESIT:    MOV    BYTE PTR [SCR_SAV],0    ; Show its already been restored. 
  1418.     1318 0948  06                PUSH    ES            ; Save segment 
  1419.     1319 0949  8E 06 0A0E R            MOV    ES,WORD PTR [SCR_SEG]    ; Pick up screen segment 
  1420.     1320 094D  BF 03F6                MOV    DI,ORIGIN        ; Where to start 
  1421.     1321 0950  BE 0AB5 R            MOV    SI,OFFSET SCR_BUF    ; Where the saved data are 
  1422.     1322 0953  B9 0007                MOV    CX,7            ; Lines to restore 
  1423.     1323 0956  51            RES0:    PUSH    CX            ; Save count 
  1424.     1324 0957  B9 0017                MOV    CX,LINLEN        ; Line length 
  1425.     1325 095A  F3/ A5                REP    MOVSW            ; Move to screen buffer 
  1426.     1326 095C  83 C7 72                ADD    DI,160 - ( LINLEN * 2 )    ; Ready next line 
  1427.     1327 095F  59                POP    CX            ; Restore line count 
  1428.     1328 0960  E2 F4                LOOP    RES0            ; Continue for all lines 
  1429.     1329 0962  07                POP    ES            ; Restore segment 
  1430.     1330                ; 
  1431.     1331 0963  B8 0200                MOV    AX,0200H        ; Set cursor position 
  1432.     1332 0966  BB 0000                MOV    BX,0            ; Page zero 
  1433.     1333 0969  8B 16 0A0C R            MOV    DX,WORD PTR [CUR_POS]    ; Get old position 
  1434.     1334 096D  CD 10                INT    VIDEO            ; Set the position 
  1435.     1335 096F  C3                RET 
  1436.     1336 0970                RES_SCR    ENDP 
  1437.     1337                ; 
  1438.     1338                ;    Write status block to the screen. 
  1439.     1339                ; 
  1440.     1340 0970                WRT_SCR    PROC    NEAR 
  1441.     1341 0970  06                PUSH    ES            ; Save segment 
  1442.     1342 0971  8E 06 0A0E R            MOV    ES,WORD PTR [SCR_SEG]    ; Pick up screen segment 
  1443.     1343 0975  BE 0A14 R            MOV    SI,OFFSET LIN1        ; Data for line 
  1444.     1344 0978  BF 03F6                MOV    DI,ORIGIN        ; Screen regen buffer 
  1445.     1345 097B  B9 0007                MOV    CX,7            ; Number of lines 
  1446.     1346 097E  B4 70                MOV    AH,SCRATTR        ; Attribute 
  1447.     1347 0980  51            WRT0:    PUSH    CX            ; Save line count 
  1448.     1348 0981  B9 0017                MOV    CX,LINLEN        ; Get length of the line 
  1449.     1349 0984  AC            WRT1:    LODSB                ; Get byte from logo 
  1450.     1350 0985  AB                STOSW                ; Save a word in screen memory 
  1451. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  1452. JMODEM.ASM                                                  Page     1-26
  1453.  
  1454.  
  1455.     1351 0986  E2 FC                LOOP    WRT1            ; Continue for the line 
  1456.     1352 0988  83 C7 72                ADD    DI,160 - (LINLEN * 2)    ; Offset to next line 
  1457.     1353 098B  59                POP    CX            ; Restore line count 
  1458.     1354 098C  E2 F2                LOOP    WRT0            ; Continue for all lines 
  1459.     1355 098E  07                POP    ES            ; Restore segment 
  1460.     1356 098F  C3                RET 
  1461.     1357 0990                WRT_SCR    ENDP 
  1462.     1358                ; 
  1463.     1359                ; Get segment address for screen regen buffer and base/status port for 
  1464.     1360                ; the video controller. Save addresses in code segment. 
  1465.     1361                ; 
  1466.     1362 0990                FIND_VIDEO    PROC    NEAR 
  1467.     1363 0990  1E                PUSH    DS            ; Save present 
  1468.     1364 0991  B8 ---- R            MOV    AX,BSEG            ; Get BIOS segment 
  1469.     1365 0994  8E D8                MOV    DS,AX            ; Into ours 
  1470.     1366 0996  81 3E 0063 R 03D0        CMP    WORD PTR DS:[ADDR_6845],3D0H 
  1471.     1367 099C  1F                POP    DS            ; Restore the data segment 
  1472.     1368 099D  B8 B800                MOV    AX,0B800H        ; Segment for color 
  1473.     1369 09A0  73 03                JAE    COLOR            ; Yes, its correct 
  1474.     1370 09A2  B8 B000                MOV    AX,0B000H        ; Must be B&W 
  1475.     1371 09A5  A3 0A0E R        COLOR:    MOV    WORD PTR [SCR_SEG],AX    ; Save for later 
  1476.     1372                ; 
  1477.     1373 09A8  1E                PUSH    DS 
  1478.     1374 09A9  8E 1E 0A0E R            MOV    DS,WORD PTR [SCR_SEG]    ; Pick up screen segment 
  1479.     1375 09AD  A1 0000                MOV    AX,WORD PTR DS:[0]    ; Get first word 
  1480.     1376 09B0  F7 D0                NOT    AX            ; Invert it 
  1481.     1377 09B2  A3 0000                MOV    WORD PTR DS:[0],AX    ; Put back in screen memory 
  1482.     1378 09B5  50                PUSH    AX            ; Exercise bus 
  1483.     1379 09B6  58                POP    AX 
  1484.     1380 09B7  39 06 0000            CMP    WORD PTR DS:[0],AX    ; See if it went 
  1485.     1381 09BB  9C                PUSHF                ; Save result 
  1486.     1382 09BC  F7 16 0000            NOT    WORD PTR DS:[0]        ; Change back to normal 
  1487.     1383 09C0  9D                POPF 
  1488.     1384 09C1  1F                POP    DS            ; Restore segment 
  1489.     1385 09C2  75 01                JNZ    CHKMEM            ; Memory was not writable 
  1490.     1386 09C4  C3                RET 
  1491.     1387                ; 
  1492.     1388 09C5  81 3E 0A0E R B000    CHKMEM:    CMP    WORD PTR [SCR_SEG],0B000H ; See if mono 
  1493.     1389 09CB  74 07                JZ    MONO 
  1494.     1390                ; 
  1495.     1391                ;    Color didn't work, change to Mono 
  1496.     1392                ; 
  1497.     1393 09CD  C7 06 0A0E R B000        MOV    WORD PTR [SCR_SEG],0B000H 
  1498.     1394 09D3  C3                RET 
  1499.     1395                ; 
  1500.     1396                ;    Mono didn't work, change to color 
  1501.     1397                ; 
  1502.     1398 09D4  C7 06 0A0E R B800    MONO:    MOV    WORD PTR [SCR_SEG],0B800H 
  1503.     1399 09DA  C3                RET 
  1504.     1400 09DB                FIND_VIDEO    ENDP 
  1505.     1401                ; 
  1506.     1402 09DB  ????            TIM_L    DW    ?            ; Transfer time Low word 
  1507.     1403                ; 
  1508.     1404 09DD  00            KILL    DB    0            ; Abort program. 
  1509. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  1510. JMODEM.ASM                                                  Page     1-27
  1511.  
  1512.  
  1513.     1405 09DE  00            SCR_SAV    DB    0            ; Flag to show we saved the screen. 
  1514.     1406 09DF  00            INT_FLG    DB    0            ; Flag to show hot interrupts 
  1515.     1407 09E0  0000            CNT_HI    DW    0            ; Transfer byte count 
  1516.     1408 09E2  0000            CNT_LO    DW    0            ; Low word of above. 
  1517.     1409 09E4  00            ENABLE    DB    0            ; TX enable bytes 
  1518.     1410 09E5  00            WASC    DB    0            ; Flag for carrier 
  1519.     1411 09E6  00            STATUS    DB    0            ; Port status 
  1520.     1412 09E7  00            FEND    DB    0            ; End of file? 
  1521.     1413 09E8  00            MOD_STA    DB    0            ; Modem status at interrupt time 
  1522.     1414 09E9  0000            REC_NOL    DW    0            ; Record number of file to send/rec 
  1523.     1415 = 000E                KLEN    EQU    $ - KILL        ; Length to zero out 
  1524.     1416 09EB  0400            BYTES    DW    1024            ; Bytes to read/send 
  1525.     1417 09ED  ??            TRIES    DB    ?            ; Attempts to send a block 
  1526.     1418 09EE  ??            RXTX    DB    ?            ; Receive/transm flag 
  1527.     1419 09EF  ????            CLOCK    DW    ?            ; Local timer 
  1528.     1420 09F1  ????            HANDLE    DW    ?            ; File handle 
  1529.     1421 09F3  ????            BUF_SEG    DW    ?            ; Segment of buffer 
  1530.     1422 09F5  ????            DAT_SEG    DW    ?            ; Next 64k segment 
  1531.     1423 09F7                OLD_CLK    LABEL    DWORD            ; Old clock vector 
  1532.     1424 09F7  ????            CLK_OFF    DW    ?            ; Clock offset 
  1533.     1425 09F9  ????            CLK_SEG    DW    ?            ; Clock segment 
  1534.     1426 09FB                OLD_BRK    LABEL    DWORD            ; Old break key vector 
  1535.     1427 09FB  ????            BRK_OFF    DW    ? 
  1536.     1428 09FD  ????            BRK_SEG    DW    ? 
  1537.     1429 09FF                OLD_CTC    LABEL    DWORD            ; Old ^C vector 
  1538.     1430 09FF  ????            CTC_OFF    DW    ? 
  1539.     1431 0A01  ????            CTC_SEG    DW    ? 
  1540.     1432 0A03                OLD_UART LABEL DWORD            ; Old UART interrupt address 
  1541.     1433 0A03  ????            UAR_OFF        DW    ?        ; Its offset 
  1542.     1434 0A05  ????            UAR_SEG        DW    ?        ;  and segment 
  1543.     1435 0A07  ??            OLD_MASK    DB    ?        ; Old interrupt masm 
  1544.     1436 0A08  ????            BYTE_CNT    DW    ?        ; Interrupt byte count 
  1545.     1437 0A0A  ????            WPOINT        DW    ?        ; Write pointer for interrupt 
  1546.     1438 0A0C  ????            CUR_POS    DW    ?            ; Saved cursor position 
  1547.     1439 0A0E  ????            SCR_SEG    DW    ?            ; Screen segment 
  1548.     1440                ; 
  1549.     1441 0A10  ????            PORT    DW    ?            ; Communications adapter port 
  1550.     1442 0A12  ??            COM_INT    DB    ?            ; Communications adapter interrupt 
  1551.     1443 0A13  ??            COM_MSK    DB    ?            ; Communications adapter contr mask 
  1552.     1444                ; 
  1553.     1445 0A14  C9            LIN1    DB    201 
  1554.     1446 0A15  0015[                DB    21 DUP (205) 
  1555.     1447       CD            
  1556.     1448             ]    
  1557.     1449                
  1558.     1450 0A2A  BB                DB    187 
  1559.     1451 0A2B  BA 20 4A 20 4D 20 4F        DB    186,' J M O D E M  Status ',186 
  1560.     1452       20 44 20 45 20 4D 20    
  1561.     1453       20 53 74 61 74 75 73    
  1562.     1454       20 BA            
  1563.     1455 0A42  BA 20 20 42 6C 6F 63        DB    186,'  Block :            ',186 
  1564.     1456       6B 20 3A 20 20 20 20    
  1565.     1457       20 20 20 20 20 20 20    
  1566.     1458       20 BA            
  1567. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  1568. JMODEM.ASM                                                  Page     1-28
  1569.  
  1570.  
  1571.     1459 0A59  BA 20 4C 65 6E 67 74        DB    186,' Length :            ',186 
  1572.     1460       68 20 3A 20 20 20 20    
  1573.     1461       20 20 20 20 20 20 20    
  1574.     1462       20 BA            
  1575.     1463 0A70  BA 20 20 42 79 74 65        DB    186,'  Bytes :            ',186 
  1576.     1464       73 20 3A 20 20 20 20    
  1577.     1465       20 20 20 20 20 20 20    
  1578.     1466       20 BA            
  1579.     1467 0A87  BA 20 20 20 52 61 74        DB    186,'   Rate :        cps ',186 
  1580.     1468       65 20 3A 20 20 20 20    
  1581.     1469       20 20 20 20 63 70 73    
  1582.     1470       20 BA            
  1583.     1471 0A9E  C8                DB    200 
  1584.     1472 0A9F  0015[                DB    21 DUP (205) 
  1585.     1473       CD            
  1586.     1474             ]    
  1587.     1475                
  1588.     1476 0AB4  BC                DB    188 
  1589.     1477                ; 
  1590.     1478                ;    Screen "window" contents will be saved here. 
  1591.     1479                ; 
  1592.     1480 0AB5                SCR_BUF    LABEL    BYTE 
  1593.     1481 0AB5  0D 0A 20 20 20 20 20    PRP3    DB    CR,LF,'          J M O D E M  File transfer system ' 
  1594.     1482       20 20 20 20 20 4A 20    
  1595.     1483       4D 20 4F 20 44 20 45    
  1596.     1484       20 4D 20 20 46 69 6C    
  1597.     1485       65 20 74 72 61 6E 73    
  1598.     1486       66 65 72 20 73 79 73    
  1599.     1487       74 65 6D 20        
  1600.     1488 0AE3  56312E3035            VERS    <> 
  1601.     1489                
  1602.     1490 0AE8  0D 0A 20 20 20 20 20        DB    CR,LF,'             Created by    Richard B. Johnson' 
  1603.     1491       20 20 20 20 20 20 20    
  1604.     1492       20 43 72 65 61 74 65    
  1605.     1493       64 20 62 79 20 20 20    
  1606.     1494       20 52 69 63 68 61 72    
  1607.     1495       64 20 42 2E 20 4A 6F    
  1608.     1496       68 6E 73 6F 6E        
  1609.     1497 0B17  0D 0A 20 20 20 20 20        DB    CR,LF,'             PROGRAM EXCHANGE  (719) 548-0208' 
  1610.     1498       20 20 20 20 20 20 20    
  1611.     1499       20 50 52 4F 47 52 41    
  1612.     1500       4D 20 45 58 43 48 41    
  1613.     1501       4E 47 45 20 20 28 37    
  1614.     1502       31 39 29 20 35 34 38    
  1615.     1503       2D 30 32 30 38        
  1616.     1504 0B46  0D 0A 55 73 61 67 65        DB    CR,LF,'Usage:' 
  1617.     1505       3A            
  1618.     1506 0B4E  0D 0A 4A 4D 4F 44 45        DB    CR,LF,'JMODEM S1 <filename.typ>  (to send a file via COM1)' 
  1619.     1507       4D 20 53 31 20 3C 66    
  1620.     1508       69 6C 65 6E 61 6D 65    
  1621.     1509       2E 74 79 70 3E 20 20    
  1622.     1510       28 74 6F 20 73 65 6E    
  1623.     1511       64 20 61 20 66 69 6C    
  1624.     1512       65 20 76 69 61 20 43    
  1625. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  1626. JMODEM.ASM                                                  Page     1-29
  1627.  
  1628.  
  1629.     1513       4F 4D 31 29        
  1630.     1514 0B83  0D 0A 4A 4D 4F 44 45        DB    CR,LF,'JMODEM R1 <filename.typ>  (to receive a file via COM1)' 
  1631.     1515       4D 20 52 31 20 3C 66    
  1632.     1516       69 6C 65 6E 61 6D 65    
  1633.     1517       2E 74 79 70 3E 20 20    
  1634.     1518       28 74 6F 20 72 65 63    
  1635.     1519       65 69 76 65 20 61 20    
  1636.     1520       66 69 6C 65 20 76 69    
  1637.     1521       61 20 43 4F 4D 31 29    
  1638.     1522 0BBB  0D 0A 4A 4D 4F 44 45        DB    CR,LF,'JMODEM S2 <filename.typ>  (to send a file via COM2)' 
  1639.     1523       4D 20 53 32 20 3C 66    
  1640.     1524       69 6C 65 6E 61 6D 65    
  1641.     1525       2E 74 79 70 3E 20 20    
  1642.     1526       28 74 6F 20 73 65 6E    
  1643.     1527       64 20 61 20 66 69 6C    
  1644.     1528       65 20 76 69 61 20 43    
  1645.     1529       4F 4D 32 29        
  1646.     1530 0BF0  0D 0A 4A 4D 4F 44 45        DB    CR,LF,'JMODEM R2 <filename.typ>  (to receive a file via COM2)' 
  1647.     1531       4D 20 52 32 20 3C 66    
  1648.     1532       69 6C 65 6E 61 6D 65    
  1649.     1533       2E 74 79 70 3E 20 20    
  1650.     1534       28 74 6F 20 72 65 63    
  1651.     1535       65 69 76 65 20 61 20    
  1652.     1536       66 69 6C 65 20 76 69    
  1653.     1537       61 20 43 4F 4D 32 29    
  1654.     1538 0C28  0D 0A 00            CRLF    DB    CR,LF,0 
  1655.     1539 0C2B  0D 0A 53 70 65 63 69    PRP4    DB    CR,LF,'Specified file ',0 
  1656.     1540       66 69 65 64 20 66 69    
  1657.     1541       6C 65 20 00        
  1658.     1542 0C3D  20 6E 6F 74 20 66 6F    PRP5    DB    ' not found.',0 
  1659.     1543       75 6E 64 2E 00        
  1660.     1544 0C49  20 43 61 6E 27 74 20    PRP6    DB    ' Can''t be created.',0 
  1661.     1545       62 65 20 63 72 65 61    
  1662.     1546       74 65 64 2E 00        
  1663.     1547 0C5C  0D 0A 53 65 6E 64 69    PRP7    DB    CR,LF,'Sending file ',0 
  1664.     1548       6E 67 20 66 69 6C 65    
  1665.     1549       20 00            
  1666.     1550 0C6C  0D 0A 52 65 63 65 69    PRP8    DB    CR,LF,'Receiving file ',0 
  1667.     1551       76 69 6E 67 20 66 69    
  1668.     1552       6C 65 20 00        
  1669.     1553 0C7E  0D 0A 46 69 6C 65 20    PRP9    DB    CR,LF,'File transfer aborted!',0 
  1670.     1554       74 72 61 6E 73 66 65    
  1671.     1555       72 20 61 62 6F 72 74    
  1672.     1556       65 64 21 00        
  1673.     1557 0C97  0D 0A 46 69 6C 65 20    PRP10    DB    CR,LF,'File transfer complete.',0 
  1674.     1558       74 72 61 6E 73 66 65    
  1675.     1559       72 20 63 6F 6D 70 6C    
  1676.     1560       65 74 65 2E 00        
  1677.     1561 0CB1  0D 0A 4D 6F 64 65 6D    PRP11    DB    CR,LF,'Modem carrier failed.',0 
  1678.     1562       20 63 61 72 72 69 65    
  1679.     1563       72 20 66 61 69 6C 65    
  1680.     1564       64 2E 00            
  1681.     1565 0CC9  20 20 5B 20 53 79 6E    PRP12    DB    '  [ Synchronized ] ',CR,LF,0 
  1682.     1566       63 68 72 6F 6E 69 7A    
  1683. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  1684. JMODEM.ASM                                                  Page     1-30
  1685.  
  1686.  
  1687.     1567       65 64 20 5D 20 0D 0A    
  1688.     1568       00            
  1689.     1569 0CDF  20 20 5B 20 53 79 6E    PRP13    DB    '  [ Synchronizing ] ' 
  1690.     1570       63 68 72 6F 6E 69 7A    
  1691.     1571       69 6E 67 20 5D 20    
  1692.     1572 0CF3  56312E3035            VERS    <> 
  1693.     1573                
  1694.     1574 0CF8  0D 00                DB    CR,0 
  1695.     1575 0CFA  0040[            FNAME    DB    64 DUP (0) 
  1696.     1576       00            
  1697.     1577             ]    
  1698.     1578                
  1699.     1579 0D3A  0040[            ONAME    DB    64 DUP (0) 
  1700.     1580       00            
  1701.     1581             ]    
  1702.     1582                
  1703.     1583                ; 
  1704.     1584 0D80                ORG    ((($ - START) + 16) AND 0FFF0H) 
  1705.     1585 0D80  0020[                DB    32 DUP ('STACK   ') 
  1706.     1586       53 54 41 43 4B    
  1707.     1587       20 20 20        
  1708.     1588             ]    
  1709.     1589                
  1710.     1590 0E80                STACKP    LABEL    WORD 
  1711.     1591                ; 
  1712.     1592 0E90                ORG    ((($ - START) + 16) AND 0FFF0H) 
  1713.     1593                ; 
  1714.     1594                ;    The following is used only once during initialization and will be 
  1715.     1595                ;    overwritten with data once file transfer starts 
  1716.     1596                ; 
  1717.     1597 0E90                BUFFER    LABEL    BYTE 
  1718.     1598 0E90  03F8            COMINIT    COM1<>                ; COM1 parameters 
  1719.     1599 0E92  0C            
  1720.     1600 0E93  EF            
  1721.     1601                
  1722.     1602 = 0004                CLEN    EQU    $ - COMINIT        ; Length of data to move 
  1723.     1603 0E94  02F8                COM2<>                ; COM2 parameters 
  1724.     1604 0E96  0B            
  1725.     1605 0E97  F7            
  1726.     1606                
  1727.     1607 0E98  03E8                COM3<>                ; COM3 parameters 
  1728.     1608 0E9A  0C            
  1729.     1609 0E9B  EF            
  1730.     1610                
  1731.     1611 0E9C  02E8                COM4<>                ; COM4 parameters 
  1732.     1612 0E9E  0B            
  1733.     1613 0E9F  F7            
  1734.     1614                
  1735.     1615 0EA0                PSEG    ENDS 
  1736.     1616                    END    MAIN 
  1737. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  1738. JMODEM.ASM                                                  Symbols-1
  1739.  
  1740.  
  1741. Structures and Records:
  1742.  
  1743.                 N a m e                 Width   # fields
  1744.                                         Shift   Width   Mask    Initial
  1745.  
  1746. COM1 . . . . . . . . . . . . . .      0004    0003
  1747.   COM1PRT  . . . . . . . . . . .      0000
  1748.   COM1INT  . . . . . . . . . . .      0002
  1749.   COM1MSK  . . . . . . . . . . .      0003
  1750. COM2 . . . . . . . . . . . . . .      0004    0003
  1751.   COM2PRT  . . . . . . . . . . .      0000
  1752.   COM2INT  . . . . . . . . . . .      0002
  1753.   COM2MSK  . . . . . . . . . . .      0003
  1754. COM3 . . . . . . . . . . . . . .      0004    0003
  1755.   COM3PRT  . . . . . . . . . . .      0000
  1756.   COM3INT  . . . . . . . . . . .      0002
  1757.   COM3MSK  . . . . . . . . . . .      0003
  1758. COM4 . . . . . . . . . . . . . .      0004    0003
  1759.   COM4PRT  . . . . . . . . . . .      0000
  1760.   COM4INT  . . . . . . . . . . .      0002
  1761.   COM4MSK  . . . . . . . . . . .      0003
  1762. IBUFFER  . . . . . . . . . . . .      0005    0004
  1763.   LEN  . . . . . . . . . . . . .      0000
  1764.   CTRL . . . . . . . . . . . . .      0002
  1765.   RECN . . . . . . . . . . . . .      0003
  1766.   IDATA  . . . . . . . . . . . .      0004
  1767. VERS . . . . . . . . . . . . . .      0005    0001
  1768.  
  1769. Segments and Groups:
  1770.  
  1771.                 N a m e             Length     Align    Combine Class
  1772.  
  1773. BSEG . . . . . . . . . . . . . .      0065    AT    0040    
  1774. PSEG . . . . . . . . . . . . . .      0EA0    PARA    PUBLIC    'CODE'
  1775.  
  1776. Symbols:            
  1777.  
  1778.                 N a m e             Type     Value     Attr
  1779.  
  1780. ABORT  . . . . . . . . . . . . .      NUMBER    0020    
  1781. ACK  . . . . . . . . . . . . . .      NUMBER    0006    
  1782. ADDR_6845  . . . . . . . . . . .      L WORD    0063    BSEG
  1783. ASCII  . . . . . . . . . . . . .      N PROC    0862    PSEG    Length = 0091
  1784.  
  1785. BRK  . . . . . . . . . . . . . .      F PROC    07F5    PSEG    Length = 0007
  1786. BRK_OFF  . . . . . . . . . . . .      L WORD    09FB    PSEG
  1787. BRK_SEG  . . . . . . . . . . . .      L WORD    09FD    PSEG
  1788. BUFFER . . . . . . . . . . . . .      L BYTE    0E90    PSEG
  1789. BUF_SEG  . . . . . . . . . . . .      L WORD    09F3    PSEG
  1790. BYEBYE . . . . . . . . . . . . .      L NEAR    040F    PSEG
  1791. BYPASS . . . . . . . . . . . . .      L NEAR    016E    PSEG
  1792. BYTES  . . . . . . . . . . . . .      L WORD    09EB    PSEG
  1793. BYTE_CNT . . . . . . . . . . . .      L WORD    0A08    PSEG
  1794.  
  1795. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  1796. JMODEM.ASM                                                  Symbols-2
  1797.  
  1798.  
  1799. CAN  . . . . . . . . . . . . . .      NUMBER    0018    
  1800. CANCEL . . . . . . . . . . . . .      L NEAR    020B    PSEG
  1801. CAROK  . . . . . . . . . . . . .      L NEAR    0429    PSEG
  1802. CHKMEM . . . . . . . . . . . . .      L NEAR    09C5    PSEG
  1803. CHKRES . . . . . . . . . . . . .      L NEAR    019D    PSEG
  1804. CHK_EX . . . . . . . . . . . . .      L NEAR    031A    PSEG
  1805. CHK_STA  . . . . . . . . . . . .      N PROC    0302    PSEG    Length = 001A
  1806. CLEN . . . . . . . . . . . . . .      NUMBER    0004    
  1807. CLK_EX . . . . . . . . . . . . .      L NEAR    04A4    PSEG
  1808. CLK_OFF  . . . . . . . . . . . .      L WORD    09F7    PSEG
  1809. CLK_SEG  . . . . . . . . . . . .      L WORD    09F9    PSEG
  1810. CLOCK  . . . . . . . . . . . . .      L WORD    09EF    PSEG
  1811. CLOSE  . . . . . . . . . . . . .      N PROC    0624    PSEG    Length = 000A
  1812. CLR_BUF  . . . . . . . . . . . .      N PROC    030C    PSEG    Length = 0010
  1813. CNT_HI . . . . . . . . . . . . .      L WORD    09E0    PSEG
  1814. CNT_LO . . . . . . . . . . . . .      L WORD    09E2    PSEG
  1815. CODELOC  . . . . . . . . . . . .      NUMBER    4000    
  1816. COLOR  . . . . . . . . . . . . .      L NEAR    09A5    PSEG
  1817. COMINIT  . . . . . . . . . . . .      L DWORD    0E90    PSEG
  1818. COMMA  . . . . . . . . . . . . .      L NEAR    08E6    PSEG
  1819. COMP . . . . . . . . . . . . . .      NUMBER    0002    
  1820. COM_INT  . . . . . . . . . . . .      L BYTE    0A12    PSEG
  1821. COM_MSK  . . . . . . . . . . . .      L BYTE    0A13    PSEG
  1822. CONT0  . . . . . . . . . . . . .      L NEAR    0433    PSEG
  1823. CONT1  . . . . . . . . . . . . .      L NEAR    044A    PSEG
  1824. CR . . . . . . . . . . . . . . .      NUMBER    000D    
  1825. CRC  . . . . . . . . . . . . . .      N PROC    044E    PSEG    Length = 0029
  1826. CRC0 . . . . . . . . . . . . . .      L NEAR    0463    PSEG
  1827. CREATE . . . . . . . . . . . . .      L NEAR    0601    PSEG
  1828. CREOK  . . . . . . . . . . . . .      L NEAR    0623    PSEG
  1829. CRLF . . . . . . . . . . . . . .      L BYTE    0C28    PSEG
  1830. CTC_OFF  . . . . . . . . . . . .      L WORD    09FF    PSEG
  1831. CTC_SEG  . . . . . . . . . . . .      L WORD    0A01    PSEG
  1832. CTS  . . . . . . . . . . . . . .      NUMBER    0010    
  1833. CTSDSR . . . . . . . . . . . . .      NUMBER    0030    
  1834. CUR_POS  . . . . . . . . . . . .      L WORD    0A0C    PSEG
  1835.  
  1836. DAT_SEG  . . . . . . . . . . . .      L WORD    09F5    PSEG
  1837. DECD0  . . . . . . . . . . . . .      L NEAR    0714    PSEG
  1838. DECD1  . . . . . . . . . . . . .      L NEAR    0721    PSEG
  1839. DECD2  . . . . . . . . . . . . .      L NEAR    0722    PSEG
  1840. DECODE . . . . . . . . . . . . .      N PROC    070F    PSEG    Length = 001D
  1841. DR . . . . . . . . . . . . . . .      NUMBER    0001    
  1842. DSR  . . . . . . . . . . . . . .      NUMBER    0020    
  1843.  
  1844. EASY_INT . . . . . . . . . . . .      F PROC    02BC    PSEG    Length = 0046
  1845. EAT  . . . . . . . . . . . . . .      N PROC    0344    PSEG    Length = 000C
  1846. EAT0 . . . . . . . . . . . . . .      L NEAR    034A    PSEG
  1847. ENABLE . . . . . . . . . . . . .      L BYTE    09E4    PSEG
  1848. ENCD0  . . . . . . . . . . . . .      L NEAR    0732    PSEG
  1849. ENCD1  . . . . . . . . . . . . .      L NEAR    074D    PSEG
  1850. ENCD2  . . . . . . . . . . . . .      L NEAR    0759    PSEG
  1851. ENCD3  . . . . . . . . . . . . .      L NEAR    075D    PSEG
  1852. ENCODE . . . . . . . . . . . . .      N PROC    072C    PSEG    Length = 0038
  1853. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  1854. JMODEM.ASM                                                  Symbols-3
  1855.  
  1856.  
  1857. ENDACK . . . . . . . . . . . . .      L NEAR    025C    PSEG
  1858. END_F  . . . . . . . . . . . . .      L NEAR    0251    PSEG
  1859. EOF  . . . . . . . . . . . . . .      NUMBER    0004    
  1860. EOT  . . . . . . . . . . . . . .      NUMBER    0004    
  1861. ERROR  . . . . . . . . . . . . .      NUMBER    0080    
  1862. EXITF  . . . . . . . . . . . . .      L NEAR    01B0    PSEG
  1863.  
  1864. FEND . . . . . . . . . . . . . .      L BYTE    09E7    PSEG
  1865. FIND_VIDEO . . . . . . . . . . .      N PROC    0990    PSEG    Length = 004B
  1866. FLOW . . . . . . . . . . . . . .      N PROC    03E8    PSEG    Length = 0066
  1867. FLOW0  . . . . . . . . . . . . .      L NEAR    03F4    PSEG
  1868. FNAME  . . . . . . . . . . . . .      L BYTE    0CFA    PSEG    Length = 0040
  1869. FORCE  . . . . . . . . . . . . .      N PROC    02A6    PSEG    Length = 0016
  1870.  
  1871. GET0 . . . . . . . . . . . . . .      L NEAR    0323    PSEG
  1872. GET1 . . . . . . . . . . . . . .      L NEAR    0341    PSEG
  1873. GET2 . . . . . . . . . . . . . .      L NEAR    0342    PSEG
  1874. GET_ACK  . . . . . . . . . . . .      N PROC    031C    PSEG    Length = 0028
  1875. GET_INP  . . . . . . . . . . . .      N PROC    0322    PSEG    Length = 0022
  1876.  
  1877. HANDLE . . . . . . . . . . . . .      L WORD    09F1    PSEG
  1878. HOME . . . . . . . . . . . . . .      NUMBER    8000    
  1879. HOT_IN . . . . . . . . . . . . .      L NEAR    0552    PSEG
  1880.  
  1881. INT_1  . . . . . . . . . . . . .      NUMBER    000C    
  1882. INT_2  . . . . . . . . . . . . .      NUMBER    000B    
  1883. INT_CTL  . . . . . . . . . . . .      NUMBER    0021    
  1884. INT_DAT  . . . . . . . . . . . .      L NEAR    02DD    PSEG
  1885. INT_EX . . . . . . . . . . . . .      L NEAR    02F9    PSEG
  1886. INT_FLG  . . . . . . . . . . . .      L BYTE    09DF    PSEG
  1887. INT_MS . . . . . . . . . . . . .      NUMBER    0008    
  1888. INT_RC . . . . . . . . . . . . .      NUMBER    0001    
  1889. IRQ3 . . . . . . . . . . . . . .      NUMBER    00F7    
  1890. IRQ4 . . . . . . . . . . . . . .      NUMBER    00EF    
  1891.  
  1892. KILL . . . . . . . . . . . . . .      L BYTE    09DD    PSEG
  1893. KLEN . . . . . . . . . . . . . .      NUMBER    000E    
  1894.  
  1895. LCL_CLK  . . . . . . . . . . . .      F PROC    0490    PSEG    Length = 0019
  1896. LF . . . . . . . . . . . . . . .      NUMBER    000A    
  1897. LIN1 . . . . . . . . . . . . . .      L BYTE    0A14    PSEG
  1898. LINLEN . . . . . . . . . . . . .      NUMBER    0017    
  1899.  
  1900. MAIN . . . . . . . . . . . . . .      N PROC    0100    PSEG    Length = 0039
  1901. MAP  . . . . . . . . . . . . . .      N PROC    07DE    PSEG    Length = 0017
  1902. MAP0 . . . . . . . . . . . . . .      L NEAR    07E3    PSEG
  1903. MAP1 . . . . . . . . . . . . . .      L NEAR    07EE    PSEG
  1904. MAX  . . . . . . . . . . . . . .      NUMBER    000A    
  1905. MOD_STA  . . . . . . . . . . . .      L BYTE    09E8    PSEG
  1906. MONO . . . . . . . . . . . . . .      L NEAR    09D4    PSEG
  1907. MS_DOS . . . . . . . . . . . . .      NUMBER    0021    
  1908.  
  1909. NAK  . . . . . . . . . . . . . .      NUMBER    0015    
  1910. NFILE0 . . . . . . . . . . . . .      L NEAR    05DC    PSEG
  1911. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  1912. JMODEM.ASM                                                  Symbols-4
  1913.  
  1914.  
  1915. NFILE1 . . . . . . . . . . . . .      L NEAR    05EE    PSEG
  1916. NOCY . . . . . . . . . . . . . .      L NEAR    080E    PSEG
  1917. NODOT  . . . . . . . . . . . . .      L NEAR    05EB    PSEG
  1918. NODWN  . . . . . . . . . . . . .      L NEAR    0653    PSEG
  1919. NOENC  . . . . . . . . . . . . .      L NEAR    0758    PSEG
  1920. NONAK  . . . . . . . . . . . . .      L NEAR    0200    PSEG
  1921. NONORM . . . . . . . . . . . . .      NUMBER    FFFE    
  1922. NORM . . . . . . . . . . . . . .      L NEAR    067C    PSEG
  1923. NORMAL . . . . . . . . . . . . .      NUMBER    0001    
  1924. NOUP . . . . . . . . . . . . . .      L NEAR    0645    PSEG
  1925. NOZER  . . . . . . . . . . . . .      L NEAR    0815    PSEG
  1926.  
  1927. OLD_BRK  . . . . . . . . . . . .      L DWORD    09FB    PSEG
  1928. OLD_CLK  . . . . . . . . . . . .      L DWORD    09F7    PSEG
  1929. OLD_CTC  . . . . . . . . . . . .      L DWORD    09FF    PSEG
  1930. OLD_MASK . . . . . . . . . . . .      L BYTE    0A07    PSEG
  1931. OLD_UART . . . . . . . . . . . .      L DWORD    0A03    PSEG
  1932. ONAME  . . . . . . . . . . . . .      L BYTE    0D3A    PSEG    Length = 0040
  1933. OPEN_R . . . . . . . . . . . . .      N PROC    059E    PSEG    Length = 0023
  1934. OPEN_W . . . . . . . . . . . . .      N PROC    05C1    PSEG    Length = 0063
  1935. OPN_OK . . . . . . . . . . . . .      L NEAR    05C0    PSEG
  1936. ORIGIN . . . . . . . . . . . . .      NUMBER    03F6    
  1937.  
  1938. PARSE  . . . . . . . . . . . . .      N PROC    0764    PSEG    Length = 007A
  1939. PARSE0 . . . . . . . . . . . . .      L NEAR    0780    PSEG
  1940. PARSE1 . . . . . . . . . . . . .      L NEAR    0789    PSEG
  1941. PARSE2 . . . . . . . . . . . . .      L NEAR    07CA    PSEG
  1942. PARSE3 . . . . . . . . . . . . .      L NEAR    07D3    PSEG
  1943. PARSEX . . . . . . . . . . . . .      L NEAR    079A    PSEG
  1944. PASS . . . . . . . . . . . . . .      L NEAR    08F2    PSEG
  1945. PORT . . . . . . . . . . . . . .      L WORD    0A10    PSEG
  1946. PREXT  . . . . . . . . . . . . .      L NEAR    03E7    PSEG
  1947. PROMPT . . . . . . . . . . . . .      N PROC    03D9    PSEG    Length = 000F
  1948. PRP10  . . . . . . . . . . . . .      L BYTE    0C97    PSEG
  1949. PRP11  . . . . . . . . . . . . .      L BYTE    0CB1    PSEG
  1950. PRP12  . . . . . . . . . . . . .      L BYTE    0CC9    PSEG
  1951. PRP13  . . . . . . . . . . . . .      L BYTE    0CDF    PSEG
  1952. PRP3 . . . . . . . . . . . . . .      L BYTE    0AB5    PSEG
  1953. PRP4 . . . . . . . . . . . . . .      L BYTE    0C2B    PSEG
  1954. PRP5 . . . . . . . . . . . . . .      L BYTE    0C3D    PSEG
  1955. PRP6 . . . . . . . . . . . . . .      L BYTE    0C49    PSEG
  1956. PRP7 . . . . . . . . . . . . . .      L BYTE    0C5C    PSEG
  1957. PRP8 . . . . . . . . . . . . . .      L BYTE    0C6C    PSEG
  1958. PRP9 . . . . . . . . . . . . . .      L BYTE    0C7E    PSEG
  1959.  
  1960. RDAT . . . . . . . . . . . . . .      NUMBER    0004    
  1961. RDATA  . . . . . . . . . . . . .      N PROC    0350    PSEG    Length = 0047
  1962. RDATA0 . . . . . . . . . . . . .      L NEAR    0356    PSEG
  1963. RDATA1 . . . . . . . . . . . . .      L NEAR    036E    PSEG
  1964. RDATA2 . . . . . . . . . . . . .      L NEAR    0395    PSEG
  1965. READ . . . . . . . . . . . . . .      N PROC    062E    PSEG    Length = 0096
  1966. READ0  . . . . . . . . . . . . .      L NEAR    06B4    PSEG
  1967. RECV . . . . . . . . . . . . . .      N PROC    01CA    PSEG    Length = 00AD
  1968. RECV0  . . . . . . . . . . . . .      L NEAR    01F6    PSEG
  1969. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  1970. JMODEM.ASM                                                  Symbols-5
  1971.  
  1972.  
  1973. RECV1  . . . . . . . . . . . . .      L NEAR    01FD    PSEG
  1974. RECV2  . . . . . . . . . . . . .      L NEAR    0205    PSEG
  1975. RECV3  . . . . . . . . . . . . .      L NEAR    0225    PSEG
  1976. REC_NOL  . . . . . . . . . . . .      L WORD    09E9    PSEG
  1977. RES0 . . . . . . . . . . . . . .      L NEAR    0956    PSEG
  1978. RESIT  . . . . . . . . . . . . .      L NEAR    0943    PSEG
  1979. RESP . . . . . . . . . . . . . .      N PROC    02A3    PSEG    Length = 0019
  1980. RESP0  . . . . . . . . . . . . .      L NEAR    02B0    PSEG
  1981. RES_INT  . . . . . . . . . . . .      N PROC    054A    PSEG    Length = 0054
  1982. RES_SCR  . . . . . . . . . . . .      N PROC    093B    PSEG    Length = 0035
  1983. RETRY  . . . . . . . . . . . . .      NUMBER    0008    
  1984. RLSD . . . . . . . . . . . . . .      NUMBER    0080    
  1985. RTS_DTR  . . . . . . . . . . . .      NUMBER    0003    
  1986. RXSYN0 . . . . . . . . . . . . .      L NEAR    03AA    PSEG
  1987. RXSYN2 . . . . . . . . . . . . .      L NEAR    03CB    PSEG
  1988. RXSYNCH  . . . . . . . . . . . .      N PROC    0397    PSEG    Length = 0036
  1989. RXTX . . . . . . . . . . . . . .      L BYTE    09EE    PSEG
  1990.  
  1991. SAV0 . . . . . . . . . . . . . .      L NEAR    092D    PSEG
  1992. SAV_SCR  . . . . . . . . . . . .      N PROC    08FE    PSEG    Length = 003D
  1993. SCRATTR  . . . . . . . . . . . .      NUMBER    0070    
  1994. SCR_ACK  . . . . . . . . . . . .      NUMBER    055E    
  1995. SCR_BLK  . . . . . . . . . . . .      NUMBER    054C    
  1996. SCR_BUF  . . . . . . . . . . . .      L BYTE    0AB5    PSEG
  1997. SCR_BYT  . . . . . . . . . . . .      NUMBER    068C    
  1998. SCR_CPS  . . . . . . . . . . . .      NUMBER    072C    
  1999. SCR_LEN  . . . . . . . . . . . .      NUMBER    05EC    
  2000. SCR_SAV  . . . . . . . . . . . .      L BYTE    09DE    PSEG
  2001. SCR_SEG  . . . . . . . . . . . .      L WORD    0A0E    PSEG
  2002. SDATA  . . . . . . . . . . . . .      N PROC    0277    PSEG    Length = 002C
  2003. SDATA1 . . . . . . . . . . . . .      L NEAR    028F    PSEG
  2004. SDATA2 . . . . . . . . . . . . .      L NEAR    0292    PSEG
  2005. SEND . . . . . . . . . . . . . .      N PROC    0139    PSEG    Length = 0091
  2006. SEND0  . . . . . . . . . . . . .      L NEAR    0168    PSEG
  2007. SEND1  . . . . . . . . . . . . .      L NEAR    0173    PSEG
  2008. SEND2  . . . . . . . . . . . . .      L NEAR    0176    PSEG
  2009. SENDX  . . . . . . . . . . . . .      N PROC    08F3    PSEG    Length = 000B
  2010. SENDX0 . . . . . . . . . . . . .      L NEAR    08F6    PSEG
  2011. SET_INT  . . . . . . . . . . . .      N PROC    04A9    PSEG    Length = 00A1
  2012. SET_SEG  . . . . . . . . . . . .      N PROC    0477    PSEG    Length = 0019
  2013. SHOW . . . . . . . . . . . . . .      N PROC    07FC    PSEG    Length = 0066
  2014. SHO_RES  . . . . . . . . . . . .      N PROC    03CD    PSEG    Length = 000C
  2015. STACKP . . . . . . . . . . . . .      L WORD    0E80    PSEG
  2016. START  . . . . . . . . . . . . .      NEAR    0000    PSEG
  2017. STATUS . . . . . . . . . . . . .      L BYTE    09E6    PSEG
  2018. SUBTR  . . . . . . . . . . . . .      L NEAR    08C5    PSEG
  2019. SUBTR1 . . . . . . . . . . . . .      L NEAR    08C8    PSEG
  2020. SUBTR2 . . . . . . . . . . . . .      L NEAR    08DD    PSEG
  2021. SUBTR3 . . . . . . . . . . . . .      L NEAR    08E5    PSEG
  2022. SYN  . . . . . . . . . . . . . .      NUMBER    0016    
  2023. SYNC . . . . . . . . . . . . . .      NUMBER    0040    
  2024.  
  2025. THRE . . . . . . . . . . . . . .      NUMBER    0020    
  2026. TIMEOUT  . . . . . . . . . . . .      NUMBER    0010    
  2027. Microsoft (R) Macro Assembler Version 5.00                  9/13/88 21:25:10
  2028. JMODEM.ASM                                                  Symbols-6
  2029.  
  2030.  
  2031. TIMOUT . . . . . . . . . . . . .      NUMBER    0012    
  2032. TIM_L  . . . . . . . . . . . . .      L WORD    09DB    PSEG
  2033. TRIES  . . . . . . . . . . . . .      L BYTE    09ED    PSEG
  2034. TRISTAT  . . . . . . . . . . . .      NUMBER    0008    
  2035. TXSYNCH  . . . . . . . . . . . .      N PROC    0397    PSEG    Length = 0036
  2036.  
  2037. UAR_OFF  . . . . . . . . . . . .      L WORD    0A03    PSEG
  2038. UAR_SEG  . . . . . . . . . . . .      L WORD    0A05    PSEG
  2039.  
  2040. VIDEO  . . . . . . . . . . . . .      NUMBER    0010    
  2041.  
  2042. WASC . . . . . . . . . . . . . .      L BYTE    09E5    PSEG
  2043. WASOK  . . . . . . . . . . . . .      L NEAR    0127    PSEG
  2044. WPOINT . . . . . . . . . . . . .      L WORD    0A0A    PSEG
  2045. WRITE  . . . . . . . . . . . . .      N PROC    06C4    PSEG    Length = 004B
  2046. WRITE0 . . . . . . . . . . . . .      L NEAR    06ED    PSEG
  2047. WRT0 . . . . . . . . . . . . . .      L NEAR    0980    PSEG
  2048. WRT1 . . . . . . . . . . . . . .      L NEAR    0984    PSEG
  2049. WRT_SCR  . . . . . . . . . . . .      N PROC    0970    PSEG    Length = 0020
  2050.  
  2051. YES  . . . . . . . . . . . . . .      L NEAR    079C    PSEG
  2052.  
  2053. @FILENAME  . . . . . . . . . . .      TEXT  JMODEM        
  2054.  
  2055.  
  2056.    1503 Source  Lines
  2057.    1503 Total   Lines
  2058.     258 Symbols
  2059.  
  2060.   48786 + 326638 Bytes symbol space free
  2061.  
  2062.       0 Warning Errors
  2063.       0 Severe  Errors
  2064.